vscode 没有显示 git 密码提示
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/50951416/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
vscode not showing git password prompt
提问by mihca
I have a git repo on a remote server and use ssh with password authentication to clone,pull,push. From command line everything works fine.
我在远程服务器上有一个 git repo,并使用带有密码身份验证的 ssh 来克隆、拉取、推送。从命令行一切正常。
However in vscode when I try to pull or push from remote repository, no password prompt is shown. Vscode seems to be waiting for something but nothing happens. Is this a bug, or am I doing something wrong?
但是在 vscode 中,当我尝试从远程存储库拉取或推送时,没有显示密码提示。vscode 似乎在等待什么,但没有任何反应。这是一个错误,还是我做错了什么?
I want to use visual studio code as git client on linux.
我想在 linux 上使用 Visual Studio 代码作为 git 客户端。
From command line:
从命令行:
In vscode:
在 vscode 中:
采纳答案by hitecherik
There are two solutions I can think of:
我能想到的解决方案有两种:
- Set up an SSH key so that you never need credentials for accessing the server the remote repository is on
- Tell git to remember credentials when you type them in - this answertells you how
- 设置 SSH 密钥,这样您就永远不需要凭据来访问远程存储库所在的服务器
- 告诉 git 在您输入凭据时记住凭据 -这个答案告诉您如何
EDIT:
编辑:
Here is a quick recipe how to set up an SSH key for your git repo:
这是一个如何为您的 git 存储库设置 SSH 密钥的快速方法:
On the client side(where you cloned the repository)
在客户端(您克隆存储库的位置)
- Check if you have an ssh key in
~/.ssh
- If not, generate an SSH key without passphrase using
ssh-keygen
(mine is calledid_rsa
) - add this key to the authentication agent using
ssh-add ~/.ssh/id_rsa
- 检查您是否有 ssh 密钥
~/.ssh
- 如果没有,请使用
ssh-keygen
(我的称为id_rsa
)生成不带密码的 SSH 密钥 - 将此密钥添加到身份验证代理使用
ssh-add ~/.ssh/id_rsa
On the remote side(where the repo is hosted)
在远程端(托管存储库的地方)
- create the file
~/.ssh/authorized_keys
- into this file copy and past your public key, which you just created on the client side (mine is saved in
~/.ssh/id_rsa.pub
)
- 创建文件
~/.ssh/authorized_keys
- 复制到此文件中,并通过您刚刚在客户端创建的公钥(我的保存在 中
~/.ssh/id_rsa.pub
)
Afterwards try a git pull
on the client side. It should not ask for a password anymore and pull/push from vscode should work as well
然后git pull
在客户端尝试 a 。它不应该再要求输入密码,并且从 vscode 拉/推也应该工作
回答by omnivorosaur
VSCode (1.25) does show password input prompt on Git https
clone
(if required) or push
.
VSCode (1.25) 确实在 Git https
clone
(如果需要)或push
.
That is the feature is available. Not sure if your problem is ssh
related, in which case it may be a bug, you may log on the VSCode issue-tracker.
那就是该功能可用。不确定您的问题是否ssh
相关,在这种情况下可能是错误,您可以登录 VSCode 问题跟踪器。