I am using git (2.46.0, currently latest version) in Windows 10. I have correctly written config file in ~/.ssh/config (or C:\Users<user_name>.ssh\config):
Host tt
HostName github.com
IdentityFile ~/.ssh/id_rsa_xxx
IdentitiesOnly yes
The problem is, when I run git clone git@tt:<github_user_name>/test3.git
, it says that:
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.
I have read questions like Git for Windows does not read SSH config, but the problem cannot be solved.
Running git config --list
gives
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
Running ssh -T git@tt
gives
Hi <github_user_name>! You've successfully authenticated, but GitHub does not provide shell access.
How can I solve this problem? Thanks in advance!
Edit:
Running (in powershell) $Env:GIT_TRACE=1
, git clone git@tt:<github_user_name>/test3.git
gives
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.
Running git -c core.sshCommand="ssh -vvv" clone git@tt:<github_user_name>/test3.git
gives
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.