Skip to content

Latest commit

 

History

History
40 lines (28 loc) · 891 Bytes

README.md

File metadata and controls

40 lines (28 loc) · 891 Bytes

Git Profiles

If you want to have different account setup for e.x. Work and Personal projects you can do something like:

SSH keys

  • Generate keys like:
ssh-keygen -f ~/.ssh/id_rsa_<profile_name> -t ed25519 -C "email@example.com"

Remember to connect them with you Github account.

Create Profiles

  • Create directory (or choose where you want them to have), and create files:
  • ~/.git_profiles/<profile_name>.gitconfig:
[user]
  name = Github Account Name
  email = email@example.com
[core]
  sshCommand = ssh -i ~/.ssh/id_rsa_<profile_name> -F /dev/null

Use Profiles

  • Create ~/.gitconfig
  • Setup users like:
[includeIf "gitdir:~/Code/Personal/"]
  path = ~/.git_profiles/<profile_name>.gitconfig
[includeIf "gitdir:~/Code/Work/"]
  path = ~/.git_profiles/<another_profile_name>.gitconfig

It will use profile in all subdirectories