git - How to setup Github SSH login when host username and Github account are different? -


i have following "fake" configuration:

  • a server: server1
  • a username in server1: user1
  • a private github repository: repo1
  • a github account: user2

i have created ssh key user1 on server1 running:

ssh-keygen 

i have added id_rsa.pub key github account: user2.

i have tested ssh connection server1 logged in user1 github running following commands:

ssh -t git@github.com ssh -t -p 443 git@ssh.github.com 

both command successful meaning can connect. try run: git pull being asked username , password, why?

i trying avoid enter username/password each time need perform pull/commit/push.

the repository configured https:

remote.origin.url=https://github.com/company/repo.git 

should change remote url https ssh? missing?

note: "fake" not use real names configuration exists.

you need use remote url ssh ensure ssh key used: git@github.com:company/repo.git.

the easiest way probably:

git remote remove origin git remote add origin git@github.com:company/repo.git 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -