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
If server detects a conflict when someone pushes data (and if two users are doing this "simultaneously" one of the pushes will be conflicting, because it will be applied only after the other one completes), the server will reject it, and the unlucky user shall then resolve conflicts and try to push again.
First of all, clone the repo to your new system and then initialize it. Once done this change to that directory and copy or reapply the changes to the cloned repo and then add to it. $ git add . After that commit and push the changes to the remote repo.
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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With