Invalid Github username

I have setup with guthub with a previous github account on this computer called myaccount when I run this command

ssh -T git@github.com Hi myaccount! You've successfully authenticated, but GitHub does not provide shell access. 

Ok, but now I have a new github account called samaccount, but I cannot run this command. I get this error.

 git push -u origin master 

i get this error

 ERROR: Permission to samueleast/Samuel-East-S3-Audio-Playlist-Player.git denied to myaccount. 

I do not want him to use myaccount, he must use samaccount !!!

I followed all the steps here http://help.github.com/mac-set-up-git/ install the new ssh key.

and also run this command many times

 git config --global user.name "samaccount" 

but he still uses myaccount, its sooo annoying, where am I going wrong ???

+3
source share
1 answer

GitHub recognizes you as myaccount because SSH uses the key corresponding to the public key that was added to the myaccount account on the GitHub website.

If you want to completely switch to using the sameueleast account instead of myaccount , you can do the following:

  • Log in to GitHub as myaccount
  • Go to Account Settings
  • Go to SSH Public Keys
  • Remove your public key from this list
  • Output
  • Log in to GitHub as samueleast
  • Go to "Account Settings" β†’ "SSH Public Keys"
  • Select "Add another public key" and paste the contents of the public key. You public key will (probably) be called id_rsa.pub or id_dsa.pub and be in your .ssh .

On the other hand, if you want to use either myaccount or samueleast when clicking on GitHub, you will need to create aliases for git@github.com in ~/.ssh/config , for example:

 Host github-myaccount User git Hostname github.com PreferredAuthentications publickey IdentityFile ~/.ssh/id_dsa-myaccount.pub Host github-samueleast User git Hostname github.com PreferredAuthentications publickey IdentityFile ~/.ssh/id_dsa-samueleast.pub 

It is assumed that you created a second SSH key pair and gave them names as described above. Then you need to make sure that you use the appropriate alias in the URLs of your git remotes. For example, if you want to change the origin console, so clicking on the origin means "clicking on the origin as samueleast", you can do:

  git remote set-url origin \ git@github-samueleast :samueleast/Samuel-East-S3-Audio-Playlist-Player.git 
+12
source

Source: https://habr.com/ru/post/1442376/


All Articles