Generate ~/.ssh/id_rsa_git
ssh key for personal projects,
add public key part to your personal bitbucket account.
Generate ~/.ssh/id_rsa_wrk
ssh key for work projects,
add public key part to your work bitbucket account.
Create ~/git
dir for personal projects.
Create ~/wrk
dir for work projects.
Place all pet git repos under ~/git
.
Place all work git repos under ~/wrk
.
~/.gitconfig
[pull]
ff = only
[includeIf "gitdir:~/wrk/"]
path = ~/.gitconfig-wrk
[includeIf "gitdir:~/git/"]
path = ~/.gitconfig-git
~/.gitconfig-wrk
[user]
name = Work Account
email = [email protected]
[core]
sshCommand = ssh -F ~/.ssh/config-wrk
~/.gitconfig-git
[user]
name = Perr Sonal
email = [email protected]
[core]
sshCommand = ssh -F ~/.ssh/config-git
~/.ssh/config
Host *
UseKeychain yes
~/.ssh/config-wrk
Include ~/.ssh/config
Host bitbucket.org
HostName bitbucket.org
User git
IdentityFile ~/.ssh/id_rsa_wrk
~/.ssh/config-git
Include ~/.ssh/config
Host bitbucket.org
HostName bitbucket.org
User git
IdentityFile ~/.ssh/id_rsa_git
check:
$ cd ~/git/pet
$ git config user.name
Perr Sonal
$ cd ~/wrk/project
$ git config user.name
Work Account
or git config --list
to list full config