0

Two years ago, I downloaded git and logged into my git account on my friend's laptop to do homework.

Fast forward to today, and he's now a computer science major. He tried pushing to his friend's repository, but he's getting an error:

remote: Permission to <repo> denied to <my username>.
fatal: unable to access <repo URL>: The requested URL returned error: 403.

See, it's denying access because my account doesn't have access. So I tried using

git config --global user.name

to change it, but it still returns the exact same error. I even tried deleting all of the SSH keys. Nothing changed.

So why does git still think I'm logged in on his computer? And how do I fix it? I feel really bad, because he may never be able to use git properly, unless he wants to add my account to every project he ever works on.

Thanks!

danharel
  • 15
  • 1
  • 4
  • The last time I checked, git doesn't do access control on its own. What are you using in combination with git? – Reactormonk Mar 08 '15 at 08:31
  • Config `user.name` only affects name that appear in commits. You should care about ssh keys. Make sure your friend is using his own ssh key and this key is added to his account on site where repo is hosted. – Max Komarychev Mar 08 '15 at 09:29
  • @MaxK Thanks for the heads up. How does he make his own proper ssh key and add it? – danharel Mar 08 '15 at 10:20
  • @danharel, hard to give a guide without much details. Where is your repo hosted? You may start from github's guide https://help.github.com/articles/generating-ssh-keys/ as a reference. Or provide more details for us to help you with. – Max Komarychev Mar 08 '15 at 12:10
  • Generic algorithm: 1. create a local key with `ssh-keygen` command. 2. go to hosted repo site and find a place where ssh keys are managed (depends on where is your repo hosted) 3. upload public key to the website – Max Komarychev Mar 08 '15 at 12:13
  • If you want to access multiple accounts. Check this http://stackoverflow.com/questions/3860112/multiple-github-accounts-on-the-same-computer else delete ~/.ssh/id_rsa and generate new keys for your friend account – Vishwanath Mar 08 '15 at 14:15

0 Answers0