Gangmax Blog

GitHub Personal Access Token

According to the post from GitHub, “Beginning August 13, 2021, we will no longer accept account passwords when authenticating Git operations on GitHub.com.”

So I need to use token authentication instead. Here is how. From here.

  1. Go to “github.com -> Settings -> Developer settings -> Personal access tokens”, create a token first. Let’s say the token value is “ThIsiStHeToKeNcOnTeNt”.

  2. Go to your local git repo and run the following command:

1
2
3
4
5
6
# Remove the existing tracked repository.
git remote remove replica
# Add the tracked repository with token info.
git remote add replica https://oauth2:ThIsiStHeToKeNcOnTeNt@github.com/user/project.git
# 3. Set upstream branch.
git branch --set-upstream-to=origin/master master
  1. Now you should be able to do your git operations, without typing the password anymore.

Comments