在一个临时使用的服务器上推送git代码:
github Dashboard页面点击头像 → Settings → Developer settings → Personal access tokens → Generate a personal access token
选择Fine-grained tokens
点击Generate new token
填写 token名称,过期时间,Description等
选择Only select repositories,选择想要开放权限的库
Permissions 里面选择 Repository permissions → Contents ,选择Read-Only则只能git pull,选择Read and Write 则可以pull和push之类的
其他不用改,点击Generate生成token
在服务器上,git remote set-url origin https://YOUR_TOKEN_HERE@github.com/your_user/your_project.git
即可授予临时push权限