7

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 "MYEMAIL@gmail.com",

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://git@github.com/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 "MYUSERNAME@gmail.com"

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
erin
  • 1,130
  • 3
  • 17
  • 28
  • What does `git remote -v` gives you for the first clone on the first computer? Also an ssh address for push? Or an https address (which you could use for pushing for your second repo). Where is your ssh pub/private keys on your second computer? It should at `$HOME/.ssh/id_rsa(.pub)`, knowing that, if you are on Windows, `HOME` isn't defined by default. – VonC Mar 19 '12 at 20:00
  • Oh I see what the issue is. I named my public key "github.pub" rather than "id_rsa.pub". I didn't realize github was that sensitive to the string name of the public key file. Thanks! – erin Mar 19 '12 at 21:15
  • Excellent. I have published an answer with that specific element, for more visibility. – VonC Mar 19 '12 at 21:30

1 Answers1

3

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:

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250