簡體   English   中英

如何讓 VSCode 遠程容器讀取 ssh 配置文件?

[英]How to make VSCode Remote Container read the ssh config file?

我有一個相當廣泛的.ssh/config文件,其中包含以下條目:

Host gitlab.com
    Preferredauthentications publickey
    HostName gitlab.com
    User git
    IdentityFile ~/.ssh/gitlab.pub
    IdentitiesOnly yes

我還使用 SSH 代理來提供私鑰。 現在,當我在 VSCode 中使用此設置時,容器似乎不知道配置文件。 我遇到如下錯誤:

Received disconnect from 172.65.251.78 port 22:2: Too many authentication failures
Disconnected from 172.65.251.78 port 22
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

通過在容器中運行GIT_SSH_COMMAND="ssh -v" git fetch ,我發現所有密鑰都已嘗試過,並且在嘗試 5 次后 Gitlab Z765553E6C7AC8592C389ACt9878 想要繼續服務器。 所以 ssh-agent 被轉發到容器,而不是配置文件。 在容器外,一切正常。

有人對此有解決方案嗎?

我的環境:

Version: 1.53.0
Commit: 8490d3dde47c57ba65ec40dd192d014fd2113496
Date: 2021-02-03T15:56:04.185Z
Electron: 11.2.1
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Linux x64 5.10.13-arch1-2

Remote-Containers: v0.158.0
 IdentityFile ~/.ssh/gitlab.pub

這似乎是錯誤的:通常,IdentityFile 引用私有SSH 密鑰,而不是公共密鑰:

IdentityFile ~/.ssh/gitlab

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM