简体   繁体   English

使 vsCode 在推送时不要求输入 gitlab ssh 密码

[英]Make vsCode not ask for gitlab ssh passphrase on push

I created the ssh key, added it on gitlab, and followed the instructions.我创建了 ssh 密钥,将其添加到 gitlab 上,然后按照说明进行操作。 When I do a push from git bash everything works fine, it keeps annoying me to enter the passphrase every time.当我从 git bash 进行推送时,一切正常,每次输入密码都让我很烦。 But when I try to push from vsCode it doesn't ask me for the passphrase and throws an error但是当我尝试从 vsCode 推送时,它不会要求我输入密码并抛出错误

Git: git@gitlab.com: Permission denied (publickey,keyboard-interactive). Git:git@gitlab.com:权限被拒绝(公钥,键盘交互)。

Is there any way to fix this?有没有什么办法解决这一问题? And bonus help: how can I stop it from asking me every time for the passphrase.额外的帮助:我怎样才能阻止它每次都询问我的密码。

I know, there are similar questions around for my bonus help, but I couldn't find anything about the vsCode issue.我知道,我的奖金帮助也有类似的问题,但我找不到任何关于 vsCode 问题的信息。 I am using windows 11.我正在使用 windows 11。

Sorry if the title is misleading.抱歉,如果标题具有误导性。


I think you have given passphrase while creating the keys that is why, you need to supply passphrase everytime you commit something. 我认为您在创建密钥时已经给出了密码,这就是为什么每次提交内容时都需要提供密码。 One solution is that update/ re make the ssh keys without passphase and add it to gitlab. 一种解决方案是更新/重新制作没有密码的 ssh 密钥并将其添加到 gitlab。

But when I try to push from vsCode it doesn't ask me for the passphrase and throws an error但是当我尝试从 vsCode 推送时,它不会要求我输入密码并抛出错误

It will ask you, starting with VSCode 1.72 (Sept. 2022) :VSCode 1.72(2022 年 9 月)开始,它会询问您:

When an SSH key with a passphrase is used for Git operations, VS Code will now display the quick input control so that you can enter the passphrase for the SSH key.当带有密码的 SSH 密钥用于 Git 操作时,VS Code 现在将显示快速输入控件,以便您可以输入 SSH 密钥的密码。

The passphrase is not cached and has to be entered every time a Git operation is performed.密码不会被缓存,每次执行 Git 操作时都必须输入密码。

Using an ssh-agent should help avoiding the passphrase (more than once per session).使用 ssh-agent 应该有助于避免密码短语(每个会话不止一次)。 See " VScode on OSX - GIT ssh key passphrase - working from build in terminal put not from command palette ".请参阅“ OSX 上的 VScode - GIT ssh 密钥密码 - 从终端中的构建而不是从命令面板中工作”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM