Skip to content

Instantly share code, notes, and snippets.

@yeromin
Last active September 6, 2023 06:52
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save yeromin/57f3f7962b0f91300150840bbc2cda69 to your computer and use it in GitHub Desktop.
Save yeromin/57f3f7962b0f91300150840bbc2cda69 to your computer and use it in GitHub Desktop.

Два Git аккаунта

В папке ~/%userprofile%/.ssh/ должен быть config, ключи (публичные *.pub и не публичные без расширения) а так же known_hosts

Config :

# Personal Github
Host github.com
User __________
IdentityFile ~/.ssh/id_rsa

 # Company GitLab - HEDGEHOG
Host gitlab.com
User ___________
IdentityFile ~/.ssh/id_hedgehog

known_hosts :

  1. Получаем инфу с сервака
ssh-keyscan -t rsa server_ip
  1. Вставляем в ~/.ssh/known_hosts
  2. Потом можно переключаться между аккаунтами:
ssh -i id_hedgehog
  1. И переключить Git-юзер для локального репозитория:
git config user.email адрес@почты

show your Git username & user email:

git config user.name
git config user.email

or:

git config --list

or open

~/.gitconfig

Change GITuser for the specific folder:

git config user.name "Alvin J. Alexander"
git config user.email "Alvin@gmail.com"

change your GLOBAL Git username like this:

git config --global user.name "Alvin J. Alexander"

change your Git email address like this:

git config --global user.email [your email address here]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment