我在 Windows 10 中使用 git(2.46.0,目前最新版本)。我已在 ~/.ssh/config(或 C:\Users\
我在 Windows 10 中使用 git(2.46.0,目前最新版本)。我已在 ~/.ssh/config(或 C:\Users\
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.