GitHub 总是掉授权,电脑记不住 token

305 天前
 FaiChou

由于 GitHub 已经关闭了 https 的账号密码形式的验证,现在只能通过生成 token 的形式来当密码。

When Git prompts you for your password, enter your personal access token.

但电脑老是记不住这个 token ,下次 git fetch 还是会弹用户名和密码。

我两台电脑,MBA 没问题,出问题的是新的 mac mini ,而且 mini 之前是没问题的,前几天刚出变成这样。

在 keychain access 中查看 github 类型为 Internet password 的记录,在 Mac mini 上是没有的。

所以不知道是什么情况。

有没有遇到的小伙伴?应该怎么解决?

1994 次点击
所在节点    程序员
9 条回复
GeruzoniAnsasu
305 天前
https://sheepblackish.medium.com/set-up-git-credentials-on-mac-os-with-private-key-github-access-token-8bf7b79e91d4

不过我基本不用 HTTPS ,用 SSH

SSH 协议用的是我的 gpg 公钥来验证,gpg suite ( gpg keychain )向我询问一次私钥保护密码后就一直 cache 了
FaiChou
305 天前
@GeruzoniAnsasu 看来以后要都换成 ssh 了 没那么多问题了。
codehz
305 天前
下载一个 github desktop 登录吧(
或者用 github cli 也可以
(会帮你配制好本地的 git 的
Explr
305 天前
试试换个 credential helper ?比如 manager-core 或者 manager ?

https://git-scm.com/docs/gitcredentials

https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage
thinkershare
305 天前
应该是系统的密钥凭证管理有问题,或者 github 没有在 mac mini 上正确使用凭证管理,如果你能够确保你的系统是安全的话,可用这样做, 这两种模式的缺点是别人通过 git remote 或者查看你的 git config 文件能够盗取你的凭证。
git clone https://$gphKey@github.com/$user/$repository.git
git clone https://oauth2:$oauth2Key@github.com/$user/$repository.git
julyclyde
305 天前
如果你定位到是 keychain 的问题,你看看那个记录是否在 icloud chain 里?
mohumohu
305 天前
Github Desktop 一键
wxxxcxx
305 天前
装一个 github 的 cli 客户端,然后

```
gh auth login
```

然后 git 用 https 就行了,我一直这么操作的。
blankmiss
304 天前
或者用 ssh 认证

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/955232

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX