Skip to content

Instantly share code, notes, and snippets.

@AidasK
Created April 2, 2024 12:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AidasK/a4853249a71e5dd3a2c10f46cb4e48d3 to your computer and use it in GitHub Desktop.
Save AidasK/a4853249a71e5dd3a2c10f46cb4e48d3 to your computer and use it in GitHub Desktop.
Working with multiple github users on different projects
// .git/config file example, update each project
[remote "origin"]
url = git@gitlab.com-CUSTOMUSER:repo-namespace/reponame.git
fetch = +refs/heads/*:refs/remotes/origin/*
// .ssh/config file example
Host gitlab.com-CUSTOMUSER
Hostname gitlab.com
User git
UseKeychain yes
IdentityFile ~/.ssh/id_rsa_CUSTOMUSER
Host *
UseKeychain yes
AddKeysToAgent no
IdentityFile ~/.ssh/id_rsa
  1. Create a separate ssh key for your new user via ssh-keygen
  2. Update your current user .ssh/config file
  3. Update each project .git/config as in example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment