2

I've got a private repo I'm trying to push to, I'm on Centos 7. I cannot use SSH. Https says

 No anonymous write access.

Stack overflow says to use personal access tokens. So I follow the directions, enable everysingle option under the token, and get a personal access token that looks something like:

 ghp_xxxxxxxxxxxxxxxxxxxxxxx

I don't understand what I'm supposed to do with it though. I tried doing what one user said, and use my user name on github, with the access token as the password. Doing this:

(note copy pasted ghp_xxxxxxxxxxxxxxxxxxxxxxx below, where ghp_xxxxxxxxxxxxxxxxxxxxxxx is replaced by the actual token in real life)

[comp@comp-desktop my_fork]$ git push other_repo
error: unable to read askpass response from '/usr/libexec/openssh/gnome-ssh-askpass'
Username for 'https://github.com': MyUserName
error: unable to read askpass response from '/usr/libexec/openssh/gnome-ssh-askpass'
Password for 'https://MyUserName@github.com': 
remote: No anonymous write access.
fatal: Authentication failed for 'https://github.com/MyUserName/my_fork.git/'

so I get the same issue.

Then I saw someone said to do something like:

git push https://<ACCESS_TOCKEN>@github.com/username/repo_name.git

so I did this:

git push https://ghp_xxxxxxxxxxxxxxxxxxxxxxx@github.com/MyUserName/my_fork.git
remote: No anonymous write access.
fatal: Authentication failed for 'https://ghp_xxxxxxxxxxxxxxxxxxxxxxx@github.com/MyUserName/my_fork.git'

Saw someone else put the name infront, this time I got no gui prompt, but still same result

git push https://MyUserName:ghp_xxxxxxxxxxxxxxxxxxxxxxx@github.com/MyUserName/my_fork.git
remote: No anonymous write access.
fatal: Authentication failed for 'https://MyUserName:ghp_xxxxxxxxxxxxxxxxxxxxxxx@github.com/MyUserName/my_fork.git'

So is it just impossible for me to use private repos on github?

Krupip
  • 4,404
  • 2
  • 32
  • 54
  • "I don't understand what I'm supposed to do with it though" That would depend on what system you are running on your computer. – matt May 11 '22 at 20:43
  • 1
    This is the place to look: https://stackoverflow.com/questions/68775869/support-for-password-authentication-was-removed-please-use-a-personal-access-to I find it really hard to believe that the answer isn't there. – matt May 11 '22 at 20:44
  • @matt 1. Litterally did that, same error. 2. Not on macos. 3. Did that, same error. 4. Don't have my credentials cached, same error. 5. same answer as before, another reason you should read these yourself, half are duplicate answers. 6. don't have my credentials cached. 7. duplicate. 8. duplicate 9. duplicate 10. not on macos 11. duplicate 12. not on macos 13. not my platform 14. duplicate 15. duplicate 16. not my platform 17. nmp 18. duplicate Honestly I'm getting tired, the rest are all duplicates or not my platforms. – Krupip May 12 '22 at 03:06

1 Answers1

0

First, make sure your token has at least the repo scope.

Second, the GitHub official documentation confirms:

$ git clone https://github.com/username/repo.git
Username: your_username
Password: your_token

Double-check the output of git config --global credential.helper to make sure nothing was cached. The only one I use on CentOS7 is git config --global credential.helper 'cache --timeout 3600'.

Check also your version of Git (I know on my CentOS7 server, it can be... quite old: 1.8.x! And yes, no SSH egress would ever be allowed)

Finally, from this thread, try and make sure you have 2FA activated for your GitHub account.

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