【发布时间】:2022-01-21 14:45:03
【问题描述】:
所以对于 Windows,我看到默认的 ssh 客户端配置应该放在 C:\Users\Admin\.ssh\config 并且我使用相同的,我也是管理员用户。
我添加了以下 ssh 客户端配置:
PS C:\Users\Admin> type .\.ssh\config
Host gc
HostName gitlab.com
User git
IdentityFile ~/.ssh/company_gitlab
Host gp
HostName gitlab.com
User git
IdentityFile ~/.ssh/gitlab_personal
我从 Powershell 对其进行了测试,我的公司和个人 GitLab 帐户使用各自的 ssh 密钥为working。
PS C:\Users\Admin> ssh -T git@gc
Enter passphrase for key 'C:\Users\Admin/.ssh/company_gitlab':
Welcome to GitLab, @johnwilson!
PS C:\Users\Admin> ssh -T git@gp
Enter passphrase for key 'C:\Users\Admin/.ssh/gitlab_personal':
Welcome to GitLab, @jwilson!
但是对于 vscode,当我尝试将更改推送或拉取到远程存储库时,公司和个人 GitLab 帐户都会出现以下错误。
> git push -u gc master
git@gitlab.com: Permission denied (publickey,keyboard-interactive).
fatal: Could not read from remote repository.
> git push -u gp master
git@gitlab.com: Permission denied (publickey,keyboard-interactive).
fatal: Could not read from remote repository.
我也尝试了here 的建议
PS C:\Users\Admin\ownCloud\Company\GitLab\userlist> git remote add origin git@gc:company/infra_code/userlist.git
PS C:\Users\Admin\ownCloud\Company\GitLab\userlist> git remote -v
origin git@gc:company/infra_code/userlist.git (fetch)
origin git@gc:company/infra_code/userlist.git (push)
PS C:\Users\Admin\ownCloud\Company\GitLab\userlist> git ls-remote origin
Enter passphrase for key 'C:\Users\Admin/.ssh/company_gitlab':
611b36ef47056773c288499cb6974d8671196d78 HEAD
611b36ef47056773c288499cb6974d8671196d78 refs/heads/master
我很困惑,所以 vscode 没有在 windows 上选择默认的 ssh 客户端配置C:\Users\Admin\.ssh\config?。
还是我错过了什么?
【问题讨论】:
-
很遗憾,没有。
标签: visual-studio-code gitlab vscode-remote