142
votes

I was using username password for pushing my code, it was working for several months but suddenly I'm not able to do it and getting this error:

Username for 'https://github.com': shreyas-jadhav
Password for 'https://[email protected]': 
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.

Please note that link doesn't help. Even using the generated token doesn't help.

Moderator Note: This is part of a planned and soon-to-be permanent service change by GitHub

25
GIthub are removing username password authentication, you need to use a token from now onLiam
I have the same problem, and no, that page doesn't help. The problem is, even using a generated token as a password, the same error message appear.Narann
Why on earth is the word "brownout" used??Ross Presser
@RossPresser A "brownout" is where you lose some, but not all, power. It's a throwback to the era of incandescent bulbs, where a small power loss could cause the bulbs to noticably dim. In this context, GitHub is "dimming the lights" to let everyone know about a pending change to the service (namely that passwords will stop working altogether soon).Machavity♦

25 Answers

22
votes

EDIT

Previously accepted answer https://stackoverflow.com/a/68192528/15507251 does the job, but it is not safe because we store the token in plain text.

Storing in the keychain is the better approach is MHO.

For Windows:

you can try the @Venryx comment below but I haven't tested it.


For Mac:

I just faced this issue now

enter image description here

As suggested, I went to the dev settings by following this url and generated a token

Then I went to my key chain access in my Mac

enter image description here

I deleted (all) the row for GitHub

enter image description here

Now I went to the terminal and pushed a dummy code

git push

Terminal asked me to enter the email and password for my account.

I entered my email and, for the password, I entered the token that I generated earlier.

enter image description here

And it started to work again.

101
votes
  1. Generate a new token from github's dev settings
  2. Update remote URL git remote set-url origin https://<token>@github.com/<git_url>
  3. pull once: git pull https://<token>@<git_url>.git

and you are good to go.

25
votes

Solution for macOS

I just followed the following instructions and that's solved my issue.

  1. Generate a personal access token for github. process to generate token
  2. Open your Keychain Access.
  3. Search for github.com and double click on that.
  4. Update the password with the key you've generated recently.

N.B: I'm not sure this will work for other operating system users.

11
votes

If you're using MacOS

  1. First please delete all github credential in keychain and then please generate your token for use as your password instead due to github security policy Github --> settings --> developer settings --> personal access token

  2. Try to push or pull somethings latest on your repo then git will ask you for username and password, enter your username and your generated token from github

10
votes

Password authentication is disabled by GitHub and not supported anymore. Create and use a Personal Access Token instead of a password.

Steps to follow:

  1. Remove GitHub stored credentials from the keychain. (eg. using "Keychain Access" on Mac, or "Credential Manager" on Windows)
  2. Generate access-token from Github Settings->Developer Settings->Personal access tokens->Generate new token
  3. Save the token - As it will be available there for once only
  4. Run command git fetch (or git push, if fetching doesn't require permissions)

    If on Windows, you must run this from Powershell, not Command Prompt. Command Prompt consistently fails with the remote: Password authentication is temporarily disabled message, despite identical inputs.

  5. It will ask for your user name and password.

    If it does not ask you for your username and password, you must change your git remote url to contain your username: https://[email protected]/repo-owner/repo-name.git (see approach 2 for instructions on changing remote url)

  6. Put the access-token instead of the password when it asks for a password. (you will have to enter it twice)

OR Second Approach:

  1. Generate access-token from Github Settings->Developer Settings->Personal access tokens->Generate new token
  2. Update URL for origin locally: git remote set-url origin https://<token>@<git_url>.git
  3. Pull once: git pull https://<token>@<git_url>.git
6
votes

Here is a simple solution:

  • Go to Github -> Settings -> Developer settings -> Personal access tokens. Regenerate your token and copy it.
  • On any of your local repos, when git push, enter your username, and the password is the generated token
5
votes
  1. Creating a personal access token (https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token)

  2. on your vs code command line ..

    git config --global credential.helper [YOUR_TOKEN]

4
votes

If you are using https

  • Generate a token in your token settings as indicated in the documentation

  • If the repository already exists, you must then change your remote URL in the format : https://<username>:<token>@github.com/<repository_url>

git remote remove origin
git remote add origin https://<USERNAME>:<TOKEN>@<GIT_URL>.git
git pull # verify
  • If you clone your repository
git clone https://<USERNAME>:<TOKEN>@<GIT_URL>.git
4
votes

Solution 1

  1. Delete the existing repo (If you have any current changes make a backup of it ) mv my-repo my-repo.backup

  2. Create an SSH key and added it to GitHub (see GitHub doc)

  3. Clone the repo for SSH git clone [email protected]:group/repo-name.git

Solution 2 (Recommended solution)

  1. git remote remove origin

  2. You have to add an access token (see GitHub doc to generate a token)

  3. git remote add origin https://<token>@<git_url>.git

  4. git pull https://<token>@<git_url>.git

Using VScode

  1. Remove your GitHub access :
git credential-osxkeychain erase 
⏎  host=github.com  
⏎  protocol=https
  1. git push or git pull It will prompt you a modal click Allow and follow the process.
2
votes

Tried every method and finally, it worked for me, I was unable to push in my repo because of this error, so please at least once try this!

_____________________________GENERATE THE PERSONAL ACCESS TOKEN :

  1. Click here and generate a personal access token , it's dam easy

https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token

NOW SIMPLY PUSH IT WITH THE HELP OF THE PAT RATHER THAN PASSWORD&USERNAME___________________

2 To push changes to your repo:

git push https://[Personal Access Token]@github.com/[User Name]/[Repository Name].git

I suffered a lot, so may it help you!

1
votes

Try this (worked for me):

  1. Generate ssh key with this guide: Generating a new SSH key
  2. Remove all old remote that use https with git remote remove origin;
  3. Add new remote using ssh reference (You can get it on "code" button in your repo and then press "ssh").

enter image description here

1
votes

Solution for Ubuntu Server existing git

Remove password:

git config --global --unset user.password;
git config --local --unset user.password;

Change remote.origin.url replace by your's github username:

git config --global --replace-all remote.origin.url "https://<username>@github.com/PPEProjects/smile-eyes-be.git";
git config --local --replace-all remote.origin.url "https://<username>@github.com/PPEProjects/smile-eyes-be.git"

Pull/push

git pull
git push origin HEAD:develop

enter Personal access tokens generate from here:

https://github.com/settings/tokens

1
votes

First from the post: Token authentication requirements for API and Git operations, it said

Mid-2021 – Personal access or OAuth tokens will be required for all authenticated Git operations.

So what you need to do is use Personal Access Token to push:

1 Get your Personal Access Token

Login here to access the repository and add a new Personal Access Token: https://github.com/settings/tokens Generate one and keep the token safe (It can't be shown once you leave)

(In Android Studio, you need to get the permission of "repo", "gist" and "read:org")

2 Push with Personal Access Token

After you get the token, you can push with a command like:

git push https://[Personal Access Token]@github.com/[User Name]/[Repository Name].git
1
votes

Github is removing username password authentication

An alternative approach to what others have mentioned:

You can install and configure github cli. Much better to setup using OAuth. No need to manually remove the creds from keychain.

On MacOs with brew, the installation is even simpler

Run brew install gh and follow the following:

  1. What account do you want to log into? GitHub.com, choose GitHub
  2. What is your preferred protocol for Git operations? choose HTTPS
  3. Authenticate Git with your GitHub credentials? choose YES
  4. How would you like to authenticate GitHub CLI? choose Login with a web browser
  5. Copy the code shown in terminal -> B7C1-8E67
  6. Press Enter to open github.com in your browser
  7. Authenticate using browser

Done.

Start using git commands as you usually do. Happy Hacking :)

1
votes

There is also a very neat script that is helpful to convert HTTPS cloned git repos to use ssh protocol without removing and cloning the git repository: https://gist.github.com/m14t/3056747

1
votes

I received this error when trying to push up in VSCode... But I opened up Terminal and pushed up no problem using username/password.

Might be something you could try?

0
votes

FAST HOT FIX. got to https://github.com/settings/tokens and regenerateenter image description here last token

0
votes

Following steps worked perfectly fine for me

Steps to follow:

  • Generate access-token from Github Settings->Developer Settings->Personal access tokens->Generate new token
  • Save the token - As it will be available there for once only
  • Search for .git-credential file in system
  • Put the access-token instead of the password in that file after username.
0
votes

If you're using the https version instead of ssh one then this error will come because github is removing https method to maintain repositories.

  1. Generate SSH Key if you haven't by ssh-keygen and keep on hitting enter till ends
  2. cat ~/.ssh/id_rsa.pub copy the result
  3. visit https://github.com/settings/keys
  4. press New SSH Key and paste the key in the textbox, title can be anything you want
  5. cd <into your projects directory>
  6. git remote set-url origin [email protected]:<username-here>/<repository-name-here>.git

and you're good to go!

0
votes

All you have to do is use a generated token instead of a traditional password:

Old method using a password:

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

New method using a Token:

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

Step 1: Generating and API Token from github

Step 2: Replacing your previous cached password with the newly generated token

0
votes

You can generate your P.A.T(personal access token) via your GitHub dashboard.

Step 1: Log in to your GitHub account.

Step 2:In the upper-right corner of any page, click your profile photo, then click Settings.

 Step 3: In the left sidebar, click Developer settings.

Step 4: In the left sidebar, click Personal access tokens.

Step 5:Click Generate new token.

Step 6: Give your token a descriptive name.

Step 7:Select the scopes, or permissions, you'd like to grant this token. To use your token to access repositories from the command line, 
select repo.

Step 8:Click Generate token.

Copy your token to a safe location as once you get out that page you be able to retrieve it not unless you create a new one.

0
votes

You don't need to remove the remote, add a new one and then pull (as suggested by the accepted answer).

The simplest solution that worked for me (on Linux) was to use gh auto login and follow the CLI instructions. No further steps required.

If you don't have gh, install it following this link depending on your OS.

0
votes

If you don't want to store your token in plain text (by modifying the remote repo's URL), you can do this:

  1. Generate a new token by following the official link
  2. Make sure you copy the token by clicking on the following button. If you double click on the text and copy it, it will add an extra space and you'll keep getting the same error (even though you're not using your password anymore, but the token)

enter image description here

0
votes

This worked for me:

  1. Generate the personal Access Token (Don't forget to copy the token)
  2. Open your Keychain Access (Mac)/Credential Manager (Windows).
  3. Update GitHub Password with the new Personal Access token in KeyChain Access/Credential Manager
  4. Last Step: Do a Git Clone (Make sure you clone the repo in proper directory location)
    git clone https://github.com/username/repo.git
    Username: your_username
    Password: your_token

In my case it did not prompted me for the username and password as it was already updated in keychain Access

-7
votes

I faced this problem this afternoon and solved it by replacing my github password on my computer as described in REFERENCE3 with generated token from REFERENCE2.

  • REFERENCE1: See Token authentication requirements for API and Git operations, the password is not supported anymore.

  • REFERENCE2: So you should generate a token with this tutorial and use it to replace your password as a credential.

  • REFERENCE3: If you are not prompted for your username and password, your credentials may be cached on your computer. You can update your credentials in the Keychain to replace your old password with the token as described in this tutorial.