0
点赞
收藏
分享

微信扫一扫

Github的token更新, 替换git的token信息(git添加新的token)

洒在心头的阳光 2022-04-04 阅读 57

我的github上面的个人token一般是3个月的有效期的,每超过三个月就需要更新一次token。

github上面的操作就比较简单了,实际上就是换了个新的token:

注意: 务必保存一下token的值

下面是在git上需要替换token的方法。

  1. git remote -v 查看remote分支
[wqj@VM-0-15-centos Linux]$ git remote -v
origin	https://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@github.com/wuqiongjin/Linux.git/ (fetch)
origin	https://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@github.com/wuqiongjin/Linux.git/ (push)

中间的ghp_.....到@之前,是过期的token。

  1. 我们需要删除这个token
git remote rm origin
  1. 添加新的token
git remote add origin https://新的token@github.com/账号名称/仓库名字.git

这样就大功告成了!

下次push的时候需要使用git push --set-upstream origin main


如果还有报错

fatal: unable to access 'https://github.com********/': OpenSSL SSL_read: Connection was aborted, errno 10053

需要再执行

git config --global http.sslVerify "false"
举报

相关推荐

0 条评论