2

I have tried everything mentioned in this thread: Pushing to Git returning Error Code 403 fatal: HTTP request failed

I created a GitHub repo on my MacBook Pro, pushed some work up to it from my Lenovo laptop, and am trying to continue work on my Mac. I had been authenticating using a PAT on Windows, but coming back to the Mac using the same PAT I'm getting this error.

I've tried generating new PATs but this hasn't worked. I haven't been pushing code up to GitHub for a couple of years, and I never even needed a password to do this before, and don't remember changing any developer settings?

This is the full message I get when trying to push with GitHub password

remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: Authentication failed for 'https://github.com/<username>/<reponame>.git/'

with PAT

remote: Permission to <username>/<reponame>.git denied to <username>.
fatal: unable to access 'https://github.com/<username>/<reponame>.git/': The requested URL returned error: 403

The 403 suggests I suddenly don't have access to my own repo, but I don't know how else I can authenticate than using the PAT. Has anyone encountered this and still remained stuck after trying everything in the above link?

Alternatively, is there any way to make this non-PAT or password protected? There isn't anything particularly sensitive here so it might not need this protective layer?

  • When I get a new device I create a key that I upload to my account. This link might help: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent – kometen Feb 16 '22 at 12:43
  • 2
    What scopes did you create the token with? You need at least the `repo` scope. – bk2204 Feb 16 '22 at 22:58
  • @bk2204 this was what I needed, thank you! – Bill Muxworthy Mar 04 '22 at 13:12

3 Answers3

3

By default tokens always include read-only access to all public repositories on GitHub. Hence, to give push or pull and rights you need to select the appropriate "Scope" while creating access token.

The scope for public repositories is public_repo, and for private repositories is repo. A token with one of those scopes is the most limited access possible for Git push or pull access.

For the description of other available scopes refer the Github Documention.

0

Steps I used to solve this issue:

Repo begins cloning...

Things I tried before finding the solution:

  • Creating a granular (new) Personal Access token
  • Entering my Github password (login method deprecated)
  • Caching my UN and PW using Mac's Keychain
  • Passing in my UN and PW in the clone command, "git clone https://:/myOrg/theirApp.git"
Tristan Newman
  • 357
  • 1
  • 4
  • 13
-2

Greetings

you do probably need to create either:

  • an ssh log key, and use that as your password
  • a gpg log key, and use that as your password

how to create an ssh log key:


  • you can do that by checking settings -> developer -> create access token
  • you specify the privilges that you want to give to your token and copy it and paste it into the password field in the terminal when trying to commit

that's it
hope it helps

tmm88
  • 17
  • 2
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 17 '22 at 02:59