How to Change Your GitHub Remote Authentication from Username + Password to Personal Access Token

Eli Williams
May 4 · 3 min read
The dreaded authentication deprecation notice

Like me, you may have received the above notice (text below) after a recent push to your GitHub repo:

Basic authentication using a password to Git is deprecated and will soon no longer work. Visit https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information around suggested workarounds and removal dates.

I found the official docs a bit confusing, so after some digging, I found the following steps to be the easiest way to update your GitHub git remote from password to personal access token authentication:

  1. Go to https://github.com/settings/tokens and Log In
  2. Click “Generate new token”, and then confirm your password

3. Add a token name (you can use a naming convention to help keep track of who has which token if you like) and select your desired scopes/permissions. Basic repo read/write access can be achieved by simply checking the repo box (see below).

4. Scroll down and click “Generate token”.

5. Copy the token itself by clicking the blue clipboard. Keep this private! Do not share this token with anyone you don’t want to have access to your repo (I have included the full token in this example for demonstration purposes but I deleted it afterward).

6. Now change your remote locally. Fire up your local terminal and cd into your local repo directory. Note: if you need to remove the old remote do so now; for example, run a git remote remove origin to remove the origin remote.

7. Add your new remote in the following format:
git remote add origin https://<TOKEN>@github.com/<USERNAME>/<REPO>.git

8. Now run git remote -v and you should see something like this:

That’s it! Now try pushing a test commit to ensuring everything is working correctly, and the GitHub warnings should stop.

If you found this helpful, please consider following me on Twitter @elitwilliams for similar content.

Geek Culture

Proud to geek out.

By Geek Culture

Subscribe to receive top 10 most read stories of Geek Culture — delivered straight into your inbox, once a week. Take a look.

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

Geek Culture

A new tech publication by Start it up (https://medium.com/swlh).

Eli Williams

Written by

Founder @SQSTrading @GoFoundry and @ShopAltfree

Geek Culture

A new tech publication by Start it up (https://medium.com/swlh).

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store