Unable to click, git one repo, one user, two computers

I want to access my github registry from two different computers using the same github account. Everything works fine on the computer, and I created a repo. This is just the second computer that got messed up.

I have successfully set up the repo on github. Now I want to clone it on another machine so that I have access to push / pull.

I made a public key on a second computer and indicated my email as an email with github

ssh-keygen -t rsa -C " MYEMAIL@gmail.com ", 

then copied it to ssh keys on github website.

I cloned a repo like this

 git clone https://github.com/MYUSERNAME/MYREPO 

Next, I edited the line "url =" in the .git / config file so that it says

 url = ssh:// git@github.com /MYUSERNAME/MYREPO 

Both of my computers have the same user.name, USERNAME, and github.user configured based on my github account settings. I also set up an API token with the same token on every computer.

 git config --global user.name "FIRST LAST" git config --global user.email " MYUSERNAME@gmail.com " git config --global github.user MYUSERNAME 

However, when I try to click, this happens:

 >> git push origin master Permission denied (publickey).</code> fatal: The remote end hung up unexpectedly 
+6
source share
1 answer

The problem was named as OP erin mentions in the comments:

I named my public key " github.pub " and not " id_rsa.pub "

For ssh to work, it is important to use the default naming convention.
See for example:

+3
source

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


All Articles