8wDlpd.png
8wDFp9.png
8wDEOx.png
8wDMfH.png
8wDKte.png

Windows 版 Git 无法使用正确的 git 命令读取 SSH 配置

Dharani Dhar Golladasari 1月前

10 0

我在 Windows 10 中使用 git(2.46.0,目前最新版本)。我已在 ~/.ssh/config(或 C:\Users\ \.ssh\config)主机 tt 主机名 github.com

我在 Windows 10 中使用 git(2.46.0,目前最新版本)。我已在 ~/.ssh/config(或 C:\Users\ \.ssh\配置)

Host tt
  HostName github.com
  IdentityFile ~/.ssh/id_rsa_xxx
  IdentitiesOnly yes

问题是,当我运行时 git clone git@tt:<github_user_name>/test3.git ,它显示:

Cloning into 'test3'...
ssh: Could not resolve hostname tt: Name or service not known
fatal: Could not read from remote repository.

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

我曾经读过诸如 “Git for Windows 无法读取 SSH 配置” ,但该问题无法解决。

跑步 git config --list 给予

diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
http.sslbackend=openssl
http.sslcainfo=D:/Program Files/Git/mingw64/etc/ssl/certs/ca-bundle.crt
core.autocrlf=true
core.fscache=true
core.symlinks=false
pull.rebase=false
credential.helper=manager
credential.https://dev.azure.com.usehttppath=true
init.defaultbranch=master

跑步 ssh -T git@tt 给予

Hi <github_user_name>! You've successfully authenticated, but GitHub does not provide shell access.

我该如何解决这个问题?提前致谢!

编辑:

运行(在 powershell 中 $Env:GIT_TRACE=1 , git clone git@tt:<github_user_name>/test3.git

09:02:58.739800 exec-cmd.c:243          trace: resolved executable dir: D:/Program Files/Git/mingw64/bin
09:02:58.763535 git.c:472               trace: built-in: git clone git@tt:<github_user_name>/test3.git
Cloning into 'test3'...
09:02:58.838928 run-command.c:667       trace: run_command: unset GIT_DIR; GIT_PROTOCOL=version=2 ssh -o SendEnv=GIT_PROTOCOL git@tt 'git-upload-pack '\''<github_user_name>/test3.git'\'''
09:02:58.838928 run-command.c:928       trace: start_command: ssh -o SendEnv=GIT_PROTOCOL git@tt 'git-upload-pack '\''<github_user_name>/test3.git'\'''
ssh: Could not resolve hostname tt: Name or service not known
fatal: Could not read from remote repository.

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

跑步 git -c core.sshCommand="ssh -vvv" clone git@tt:<github_user_name>/test3.git 给予

09:13:02.388635 exec-cmd.c:243          trace: resolved executable dir: D:/Program Files/Git/mingw64/bin
09:13:02.417159 git.c:472               trace: built-in: git clone git@tt:<github_user_name>/test3.git
Cloning into 'test3'...
09:13:02.480940 run-command.c:667       trace: run_command: unset GIT_CONFIG_PARAMETERS GIT_DIR; GIT_PROTOCOL=version=2 'ssh -vvv' -o SendEnv=GIT_PROTOCOL git@tt 'git-upload-pack '\''<github_user_name>/test3.git'\'''
09:13:02.483484 run-command.c:928       trace: start_command: 'D:/Program Files/Git/usr/bin/sh.exe' -c 'ssh -vvv "$@"' 'ssh -vvv' -o SendEnv=GIT_PROTOCOL git@tt 'git-upload-pack '\''<github_user_name>/test3.git'\'''
OpenSSH_9.8p1, OpenSSL 3.2.2 4 Jun 2024
debug1: Reading configuration data /etc/ssh/ssh_config
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/c/Users/<user_name>/AppData/Roaming/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/c/Users/<user_name>/AppData/Roaming/.ssh/known_hosts2'
debug2: resolving "tt" port 22
debug3: resolve_host: lookup tt:22
ssh: Could not resolve hostname tt: Name or service not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
帖子版权声明 1、本帖标题:Windows 版 Git 无法使用正确的 git 命令读取 SSH 配置
    本站网址:http://xjnalaquan.com/
2、本网站的资源部分来源于网络,如有侵权,请联系站长进行删除处理。
3、会员发帖仅代表会员个人观点,并不代表本站赞同其观点和对其真实性负责。
4、本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
5、站长邮箱:yeweds@126.com 除非注明,本帖由Dharani Dhar Golladasari在本站《github》版块原创发布, 转载请注明出处!
最新回复 (0)
返回
作者最近主题: