Skip to content

Instantly share code, notes, and snippets.

@mayowDev
Last active December 22, 2020 12:01
Show Gist options
  • Save mayowDev/df75e86c4462b93666eebb7d0e9074c1 to your computer and use it in GitHub Desktop.
Save mayowDev/df75e86c4462b93666eebb7d0e9074c1 to your computer and use it in GitHub Desktop.
Set up Multiple git Accounts in on System

Setting up multiple GitHub users/account in same system

  • Cd ..
  • /users sudo mkdir basit
  • /users sudo chmod -R 777 basit
  • Cd basit
  • ssh-keygen -t ed25519 -C "[email protected]"
  • Cd ..
  • ~ Open .gitconfig
  • [user]
  • name = M Ahmed
    
  • email = [email protected]
    
  • [includeIf "gitdir:/Users/basit/"]
  • path = /Users/basit/.gitconfig
    
  • Then save the git config
  • ~ eval "$(ssh-agent -s)"
  • ➜ ~ ssh-add ~/.ssh/basit_rsa

Configure Git username/email --globally and repository-specific

To set your global username/email configuration:

Open the command line.

  • Set your username: git config --global user.name "FIRST_NAME LAST_NAME"

  • Set your email address: git config --global user.email "[email protected]"

To set repository-specific username/email configuration:

From the command line, change into the repository directory.

  • Set your username: git config user.name "FIRST_NAME LAST_NAME"

  • Set your email address: git config user.email "[email protected]"

Verify your configuration by displaying your configuration file:

  • cat .git/config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment