Can't push using Personal Access Token during brownout

During today’s brownout, I am unable to push to my git repository.

$ git remote -v
origin  https://github.com/parasHadesMods/ParasDoorPredictions.git (fetch)
origin  https://github.com/parasHadesMods/ParasDoorPredictions.git (push)
$ git push origin main
remote: Password authentication is temporarily disabled as part of a brownout. Please use a personal access token instead.
remote: Please see https://github.blog/2020-07-30-token-authentication-requirements-for-api-and-git-operations/ for more information.
fatal: unable to access 'https://github.com/parasHadesMods/ParasDoorPredictions.git/': The requested URL returned error: 403

Normally, when I run this command, it prompts me for my username and password, and I use my Personal Access Token as the password. However, at the moment I am not prompted at all, which is new behavior during this brownout period.

I’ve just hit the same problem. Can’t push, pull or clone private repos.

This is getting in the way of billable work. Does anyone know a workaround?

Use SSH instead of HTTPS: About SSH - GitHub Docs

Note that after setting up SSH you need to change the remote URL for your GitHub repository to the SSH one to actually use it.

1 Like

@airtower-luna Thanks for the reply! While I could grind my way through the SSH configuration, I’m afraid my client’s personnel would find it exceeds their threshold for annoyance. It’s going to be bad enough just migrating them to using PAT’s instead of passwords.

I’ve set up a number of non-technical users w/ GitHub using ssh, it’s pretty simple.

Setting up SSH public keys

  1. Open a terminal (Terminal.app, cmd.exe, or psh.exe)
  2. Run:
    ssh-keygen
    
  3. Press <enter> repeatedly (~4 times)
  4. Copy the public key
    1. On macOS:
      pbcopy < ~/.ssh/id_rsa.pub
      
    2. On Windows:
      clip < %userprofile%\.ssh\id_rsa.pub
      
  5. Go to https://github.com/settings/ssh/new
  6. Paste the key into the Key field
  7. Fill in Title with a description of the computer (e.g. work laptop, work desktop, home desktop, living room tablet)
  8. Click Add SSH key
  9. Go back to the terminal
  10. Run ssh git@github.com
  11. They should see:
    Hi <username-here>! You've successfully authenticated, but GitHub does not provide shell access.
    

Cloning a repository

  1. Go to a repository, e.g. https://github.com/Michael-F-Ellis/tbon
  2. Click the green Code button
  3. Click SSH
  4. Click the :clipboard:
  5. Go back to the terminal
  6. Type: git clone (including the trailing space!)
    1. On macOS, use cmd-v to paste
    2. On Windows, right-click, and click (to paste)
  7. Press <enter>
  8. This should yield a clone of a repository

It’s possible to fix existing repositories, but it’s probably cheaper to instruct them to delete their repositories and reclone (once they switch to using ssh in GitHub, it will remember that and offer ssh urls going forward).

1 Like

Setting up SSH is besides the point here — PATs are supposed to work, and it should be documented how to make them work.

The trick it turns out is that you have to set the remote.origin.url to include the username because git will no longer prompt for it. When it was failing, I had

$ git config remote.origin.url
https://github.com/parasHadesMods/ParasDoorPredictions.git

To fix it, I did the following:

$ git config remote.orgin.url https://parasHadesMods@github.com/parasHadesMods/ParasDoorPredictions.git

and now it works (but it only prompts for the PAT, not the username)

$ git push origin main
Password for 'https://parasHadesMods@github.com': 

That’s peculiar. Could the password be cached somewhere, e.g. in an OS keyring?

It’s definitely cached in a keyring.