【问题标题】:Key Authentication: no prompt when pushing to remote repo?密钥验证:推送到远程仓库时没有提示?
【发布时间】:2020-12-03 10:39:03
【问题描述】:

我已经设置了一个远程 git repo - 通过 SSH 使用私钥身份验证。 私钥受密码保护。

这适用于我的命令行 git(在 Windows 上):

PS C:\Users\me\myrepo> git push -u origin --all
Enter passphrase for key 'C:\Users\me\.ssh\git_rsa': [human enters password here]
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 425 bytes | 70.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
[...]
Branch 'master' set up to track remote branch 'master' from 'origin'.

在同一个 Windows 机器上 - 我有 configured Visual Studio Code 使用与命令行相同的私钥。 当我使用 Visual Studio Code 推送到远程存储库时 - 我收到一条错误消息:


[Visual Studio Code]
(X) Git: git@git.acme.com: Permission denied(publickey).

用户界面从不提示我输入私钥密码:这是问题所在吗?

我已经配置了以下 Visual Studio Code 配置:

@ext:ms-vscode-remote.remote-ssh,ms-vscode-remote.remote-ssh-edit config file

指向我的 SSH 配置文件,如下所示:

Host git.acme.com
    User git
    HostName git.acme.com
    Port 8000
    IdentityFile ~/.ssh/git_rsa

我可以确认该文件存在(如上 - 这可以从命令行 git 工作 - 我使用 $env:GIT_SSH_COMMAND 而不是配置文件指向同一个文件)。

PS C:\Users\me> gci ~/.ssh/git_rsa|select-object -Property FullName

FullName
--------
C:\Users\me\.ssh\git_rsa

【问题讨论】:

    标签: git visual-studio-code ssh


    【解决方案1】:

    尝试从控制面板的“凭据管理器”中删除密码。 Windows 将详细信息存储在那里,一旦使用它就不会显示提示。

    【讨论】:

    • 我检查过 - 不幸的是,凭据管理器似乎没有与用户对应的任何内容。不过谢谢 - 好主意。
    猜你喜欢
    • 1970-01-01
    • 2013-02-21
    • 1970-01-01
    • 2015-08-29
    • 2014-12-22
    • 2020-01-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多