std::bodun::blog

PhD student at University of Texas at Austin 🤘. Doing systems for ML.

马上订阅 std::bodun::blog RSS 更新: https://www.bodunhu.com/blog/index.xml

Handle GitHub Password Authentication Deprecation

2021年10月19日 08:00

Update: use ssh key to access the repo is strongly recommended.

Recently, GitHub deprecated the use of password for repos. You will have to generate GitHub tokens to access repos. It’s difficult for me to memorize the token without serious efforts. Fortunately, it’s easy to mitigate the problem.

After a repo is cloned, simply execute

git remote remove origin

to remote the old remote. Then, execute the following command:

git remote add origin https://<TOKEN>@github.com/<GITHUB_USERNAME>/<REPO>.git

Finally, execute the following command to setup upstream:

git push --set-upstream origin main

After this, no password is needed for git operations inside this repo. Beware you need to perform this operation for every new repo.