Login to Github via SSH

Asked

Viewed 238 times

0

Good morning! When I just go to the server via SSH and run the command sss -t [email protected], it returns a message showing which user is logged in to that site. My question is how I log in with another user on Github via SSH. I already checked the SSH key on Github, but haven’t been able to change the user yet.

1 answer

1

If you need to do it just once

git push ssh://<temp_user>@<host>/<repo_path> <local_branch>:<remote_branch>

If you need two SSH keys

enters @editoDeTextoPreferity ~/. ssh/config

# Default GitHub user (joe)
Host github.com
  HostName github.com
  User git
  IdentityFile /Users/joe/.ssh/id_rsa

# Client user (client)
Host github-client
  HostName github.com
  User git
  IdentityFile /Users/joe/.ssh/id_rsa_client

then you can use it like this

git clone [email protected]:joe/my_repo.git

and

git clone git@github-client:client/his_repo.git

The global depends on the GIT Voce is using but the cool thing is to know the concept of GIT Global to make the right change to what Voce needs.

  • Okay, thank you so much for your help!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.