问题
I created a .gitconfig
file using the command
git config --global url."https://".insteadOf git://
However, this will replace all git:// URLs WITH https://
ones, for all projects on my computer.
I want this functionality, for a specific project.
Is it possible to configure a replace for git:// URLs for https:// URLs
for a certain project/not global?
This project is shared, and I don't want everyone to go through the trouble of running the command locally.
回答1:
You can do the following:
Edit .gitconfig file and just remove the [url] section.
Cd into the project in which you want this
instead
to work.Run
git config url."https://".insteadOf git://
Explaination:
git config --global
is your user-wide setting, i.e it is applied to all projects in that users home dir. The config file is .gitconfig
and it resides in user's homedir
git config
is repository specific configuration. If adds an entry in your $GIT_DIR/config file. So it is specific to only that directory
Hope it helps!
Happy gitting!
回答2:
You can use:
git config --local
Out of your (git) project source directory to do project / repository specific configurations.
The own git documentation often helps, e.g.
git config //List of Commands & Options
git help config //the complete documentation about the config command
来源:https://stackoverflow.com/questions/25974697/git-config-global-insteadof-for-a-project-not-global