1

I creaed a GitHub personal access token for use with the Git CLI. Generating and setting it up worked great, but I gave the token the wrong permissions. Now I can't change the access token on the client. Whenever I try to do something, it just says:

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

The repository does exist and the upstream is set correctly. I have cleared all of the Git configurations like user.name and user.email. I have revoked the access token on GitHub. What else is there for me to do?! How would I do something like change accounts?

Samuel Goodell
  • 600
  • 2
  • 9
  • It looks like it's using your SSH keys, not your username+token. What protocol is the remote configured to use? – Whymarrh Nov 07 '16 at 05:13
  • They're using git@github.com:username/repo.git for fetch and push. – Samuel Goodell Nov 07 '16 at 05:15
  • If you want to use a personal access token you will need to update your remote to use HTTPS. See also: [authenticating to GitHub from Git using HTTPS](https://help.github.com/articles/which-remote-url-should-i-use/#cloning-with-https-urls-recommended). – Whymarrh Nov 07 '16 at 05:21
  • You're a miracle worker. Can you submit that as an answer so I can mark it as accepted? – Samuel Goodell Nov 07 '16 at 05:25
  • 1
    No worries, feel free to answer your own question with the detailed steps about how to generate the correct token and add the remote with the correct protocol. – Whymarrh Nov 07 '16 at 05:34
  • Actually, I don't think that's the solution - oops. Yes, that does fix the problem, but I remember now that I used the git@ protocol instead of HTTPS or SSH because using HTTPS made it repeatedly prompt me for my username and password. SSH has the same problem with my public key. – Samuel Goodell Nov 07 '16 at 05:37
  • See also http://stackoverflow.com/q/5343068/1267663 – Whymarrh Nov 07 '16 at 06:05

0 Answers0