开发者

How to enable multiple usernames for git? ie. Specific project can have specific username [duplicate]

开发者 https://www.devze.com 2023-02-06 02:33 出处:网络
This question already has answers here: git multiple user names for the different projects within the same system [duplicate]
This question already has answers here: git multiple user names for the different projects within the same system [duplicate] (2 answers) Closed 9 years ago.

I am working with 2 projects in same time. One is for my work and another is my personal project. I'd like to use git as version control software.

I have configured .gitconfig under my my directory as follows.

  1 [user]
  2   name = gladder
  3   email = gladder

So git can pickup my user settings automatically. however, I am just wondering that is it possible to get this setting in small scope开发者_Go百科?

So the project's user settings can override global user settings.


Yes, all the settings that are in $HOME/.gitconfig can be put into .git/config inside each repository.


You can use the --file flag with git config (or not as it is the default):

git config --file user.name gladder
git config --file user.email gladder

which will create/set the value in project/.git/config (as araqnid said)

Refer to git-config for more information.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号