我在 Ubuntu/Debian 机器上使用 git。 我知道如何配置存储库的用户信息(姓名、邮件)。 但对于私有 github 存储库,每次我向远程推送或从远程拉取时,它总是需要一个令牌。 这是重复的,所以我想知道是否有解决方案。我认为令牌可以保存在某个地方并自动登录,就像Window上的github桌面一样。
我搜索了谷歌但没有找到解决方案。
非常感谢您的建议!
遵循 Github 关于 SSH 密钥的官方说明 对我有用 它包含 2 个步骤:
ssh-keygen -t ed25519 -C "[email protected]"
> Generating public/private ALGORITHM key pair.
> Enter a file in which to save the key (/home/YOU/.ssh/id_ALGORITHM):[Press enter]
> Enter passphrase (empty for no passphrase): [Type a passphrase]
> Enter same passphrase again: [Type passphrase again]
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
cat ~/.ssh/id_ed25519.pub
# Then select and copy the contents of the id_ed25519.pub file
# displayed in the terminal to your clipboard