Reputation: 3628
I am using the github client and sourcetree by atlassian. I wanted to use 2 different global git configs for each software.
At the moment I have to edit and check every commit my autor and email name.
So how can I specify a unique config for each git program that I use.
king regards
Upvotes: 5
Views: 268
Reputation: 3628
I was inspired by the answer of SzG. That is my final solution:
At first have a look for the global git config. You find the .gitconfig
inside your home directory (on windows: %userprofile%\.gitconfig
, on linux: ~/.gitconfig
).
I created 2 Batches in the directory of the global git config file.
GitHub.bat & SourceTree.bat
GitHub.bat
@echo off
cd /D %userprofile%
del .gitconfig
copy GitHub.bat .gitconfig
GitHub
[user]
name = Name1
email = [email protected]
[core]
autocrlf = true
excludesfile = C:\\Users\\{windowsusername}\\Documents\\gitignore_global.txt
SourceTree.bat
@echo off
cd /D %userprofile%
del .gitconfig
copy SourceTree.bat .gitconfig
SourceTree
[user]
name = Name2
email = [email protected]
[core]
autocrlf = true
excludesfile = C:\\Users\\{windowsusername}\\Documents\\gitignore_global.txt
So this is working fine, just have to run one of these batches before commiting and i can use 2 different autor names with different email.
Upvotes: 0
Reputation: 12619
Each repo has its own configuration, which can override the system-wide and global configurations. Just enter each repo and
git config user.name xxxx
git config user.email yyyy
Note the lack of the --global
option.
Upvotes: 7