为什么LFS git的git push会要求输入密码三次?

5

我正在使用标准的github.com存储库,并开启了LFS模式,一切运作正常...但是每当我进行推送操作时,都会出现3xLogin:

git push
Username for 'https://github.com': xpto
Password for 'https://xpto@github.com': 
Username for 'https://github.com': xpto
Password for 'https://xpto@github.com': 
Locking support detected on remote "origin". Consider enabling it with:
  $ git config 'lfs.https://github.com/xpto-org/xpto-prj.git/info/lfs.locksverify' true
Username for 'https://github.com': xpto
Password for 'https://xpto@github.com': 

Git LFS: (0 of 1 files) 3.38 MB / 925.18 MB 

似乎credential.helper是一个解决方案,参见https://dev59.com/_JXfa4cB1Zd3GeqPiay4#49244743 - Peter Krauss
3个回答

1

1
尝试一下这个:
把这个加到你的~/.ssh/config文件中。
Host *
  AddKeysToAgent yes
  UseKeychain yes

启动您的ssh代理:

eval "$(ssh-agent -s)"

然后添加你的密钥:
ssh-add ~/.ssh/id_rsa

注意:你的密钥名称可能不同。

0
打开你的~/.ssh/config文件。确保它看起来完全像这样:
Host *
IdentityFile ~/.ssh/id_ed25519
UseKeychain yes
AddKeysToAgent yes

在我的情况下,还有像这样的其他行:

Host myusername-GitHub
HostName github.com
User myusername
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_ed25519
UseKeychain yes
AddKeysToAgent yes

以前它会问我5次我的密码。在删除这些额外的行并使其看起来与第一行完全相同之后,git不再要求我输入密码。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接