3

It’s been a long time since I submitted the code to Github. I reported an remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. when I accidentally submitted the code today. The error message is as follows.

(yolov4) shl@zhihui-mint:~/shl_res/5_new_project/Yolov4_DeepSocial$ git push origin master
Username for 'https://github.com': shliang0603
Password for 'https://shliang0603@github.com': 
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: unable to access 'https://github.com/shliang0603/Yolov4_DeepSocial.git/': The requested URL returned error: 403
(yolov4) shl@zhihui-mint:~/shl_res/5_new_project/Yolov4_DeepSocial$ 

It probably means that your original password credentials will no longer be usable from August 13, 2021. You must use a personal access token, which is to replace your password with a token!

Why change the password to token

The following is the official Github explanation:
In recent years, GitHub customers have benefited from many security enhancements on GitHub.com, such as two-factor authentication, login alerts, verified devices, protection from leaked passwords, and WebAuthn support. These features make it more difficult for an attacker to obtain a password that is reused on multiple websites and use it to try to access your GitHub account. Despite these improvements, due to historical reasons, customers who have not enabled two-factor authentication can still continue to authenticate Git and API operations using only their GitHub username and password.

Starting on August 13, 2021, we will no longer accept account passwords when authenticating Git operations, and will require the use of token-based authentication, such as personal access tokens (for developers) or OAuth or GitHub application installation token (for integrators) All authenticated Git operations on GitHub.com. You can also continue to use SSH keys wherever you like ( if you want to use ssh keys, please refer to ).

modified to the benefits of token:

Compared with password-based authentication, tokens provide many security advantages:

  • Unique: The token is specific to GitHub and can be generated per use or per device
  • Revocable: Tokens can be revoked individually at any time without the need to update unaffected credentials
  • Limited: The token can be narrowed down to allow only the access required by the use case
  • Random: Simpler passwords that the token does not need to be remembered or entered regularly may be affected by the type of dictionary or brute force attempts

How to generate token

1. Open Github, find [Setting] on the personal settings page, and then open and find [Devloper Settting], as shown in the figure below.
在这里插入图片描述
Then, select personal access tokens [Personal access tokens], and then select Generate new tokens.
在这里插入图片描述
In the previous step, select the scope or permissions to be granted to this token.

  • To access the repository from the command line using token, select repo
  • To delete a repository from the command line using token, select delete_repo
  • Check other as needed

Then, click [Generate token] to generate a token.
在这里插入图片描述
在这里插入图片描述
After generating the token, remember to save your token for subsequent operations. Add the token directly to the remote warehouse link, so that you can avoid entering the token every time you submit the code in the same warehouse.

git remote set-url origin https://<your_token>@github.com/<USERNAME>/<REPO>.git
  • <your_token> : Replace with the token you got yourself
  • <USERNAME> : is your own github username
  • <REPO> : is your warehouse name

Here is an example:

git remote set-url origin https://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@github.com/shliang0603/Yolov4_DeepSocial.git/

xiangzhihong
5.9k 声望15.3k 粉丝

著有《React Native移动开发实战》1,2,3、《Kotlin入门与实战》《Weex跨平台开发实战》、《Flutter跨平台开发与实战》1,2和《Android应用开发实战》