Skip to content

Instantly share code, notes, and snippets.

@ghsatpute
Created July 9, 2022 19:20
Show Gist options
  • Save ghsatpute/66f016cae31c6c90988c1125d807e807 to your computer and use it in GitHub Desktop.
Save ghsatpute/66f016cae31c6c90988c1125d807e807 to your computer and use it in GitHub Desktop.
Use two different accounts on Github CLI

~/.gitconfig

[filter "lfs"]
        clean = git-lfs clean -- %f
        smudge = git-lfs smudge -- %f
        process = git-lfs filter-process
        required = true
[user]
        name = Ganesh Satpute
        email = your-email@company.com

[includeIf "gitdir:~/code/personal/"]
    path = ~/code/personal/.gitconfig

~/code/personal/.gitconfig

[user]
        name = Ganesh Satpute
        email = personal@gmail.com

Is this required? ~/.ssh/config

Host github.com
  User git
  IdentityFile ~/.ssh/id_ed25519

Host github.com-github-personal
  HostName github.com
  User git
  IdentityFile ~/.ssh/github-personal

You need to have two keys configured on respective Github accounts and be present in .ssh directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment