GitHub seems like removed password authentication as of August 13, 2021, and personal access token is recommended by their policy. Below is the error message when I run git clone
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
To create a Personal Access Token through the GitHub online portal, you will need to follow below steps
- Log into GitHub
- Click your personal picture the the right hand menu and navigate to Settings → Developer settings → Personal access tokens → Generate new token
- You can select your required features, and below is for repository access
- If everything goes fine, you will get your token like below:
To clone with the personal token,
$ git clone https://${TOKEN}:x-oauth-basic@github.com/MyUser/MyRepo.git
And below is an exmple shell script based in zsh
#!/bin/zsh git config --global user.name "Chun Kang" git config --global user.email "ck@ckii.com" GITHUB_USER_TOKEN=your_user_token git clone https://$GITHUB_USER_TOKEN:x-oauth-basic@github.com/ck/ck.io.git