erin
erin

Reputation: 1160

Can't push, git one repo, one user, two computers

I want to access my github repo from two different computers, using one github account. Everything works fine on the computer that I created the repo on. It's just this second computer that is messed up

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

I made a public key on the second machine and specified my email as the email associated with github

ssh-keygen -t rsa -C "[email protected]",

then copied it to the SSH keys on the github website.

I cloned the repo like this

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

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

url = ssh://[email protected]/MYUSERNAME/MYREPO

Both of my computers are configured to have the same user.name, USERNAME and github.user based on my github account settings. I also configured the API token with the same token on each computer.

git config --global user.name "FIRST LAST"

git config --global user.email "[email protected]"

git config --global github.user MYUSERNAME

Yet, when I try to push, this happens:

>> git push origin master

Permission denied (publickey).</code>

fatal: The remote end hung up unexpectedly

Upvotes: 7

Views: 1155

Answers (1)

VonC
VonC

Reputation: 1325017

The issue was a naming one, as the OP erin mentions in the comments:

I named my public key "github.pub" rather than "id_rsa.pub"

For ssh to work, using default naming convention is important.
See, for instance:

Upvotes: 3

Related Questions