As the title says I'm having issues with lfs authenticate over ssh.
I'm on Windows 22H2 using openssh and gnupg gpg-agent as the ssh-agent. Don't be afraid of this and jump to this must be the issue becaues it works robustly for other ssh, git, and git-lfs combinations, and as the subject says works when tested directly.
C:\src\lfs-ssh-issue\lfs-auth-issue.bb [master ↑2]> ssh -V
OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3
C:\src\lfs-ssh-issue\lfs-auth-issue.bb [master ↑2]> git --version
13:41:47.434210 exec-cmd.c:243 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
13:41:47.449919 git.c:462 trace: built-in: git version
git version 2.41.0.windows.1
My SSH keys (provided by GNUPG via gpg-agent) are working
- Bitbucket.org git
- github (including LFS)
- ssh in general
This is demonstrated by the usual ssh git test
C:\src\lfs-ssh-issue\lfs-auth-issue.bb [master ↑2]> ssh -T git@bitbucket.org
authenticated via ssh key.
You can use git to connect to Bitbucket. Shell access is disabled
C:\src\lfs-ssh-issue\lfs-auth-issue.bb [master ↑2]>
and the command in the subject working from the shell
C:\src\lfs-ssh-issue\lfs-auth-issue.bb [master ↑2]> ssh git@bitbucket.org git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git download
{"header":{"Authorization":"<token redacted>"},"href":"https://bitbucket.org/{}/{<redacted>}/info/lfs","expires_in":300}
When the same command is executed by git itself (I'm executing git in the same shell as the I executed the direct ssh command) it hangs.
C:\src\lfs-ssh-issue\lfs-auth-issue.bb [master ↑2]> git push
13:07:08.315130 exec-cmd.c:243 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
13:07:08.315130 git.c:462 trace: built-in: git push
13:07:08.315130 run-command.c:661 trace: run_command: unset GIT_PREFIX; ssh git@bitbucket.org 'git-receive-pack '\''michael_thx/lfs-auth-ssh-issue.git'\'''
13:07:20.427673 run-command.c:661 trace: run_command: .git/hooks/pre-push origin git@bitbucket.org:michael_thx/lfs-auth-ssh-issue.git
13:07:20.506550 exec-cmd.c:243 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
13:07:20.506550 git.c:748 trace: exec: git-lfs pre-push origin git@bitbucket.org:michael_thx/lfs-auth-ssh-issue.git
13:07:20.506550 run-command.c:661 trace: run_command: git-lfs pre-push origin git@bitbucket.org:michael_thx/lfs-auth-ssh-issue.git
13:07:20.530433 trace git-lfs: exec: git 'version'
13:07:20.562332 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'remote' '-v'
13:07:20.585132 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'remote'
13:07:20.600525 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-parse' 'HEAD' '--symbolic-full-name' 'HEAD'
13:07:20.616556 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-parse' '--git-dir' '--show-toplevel'
13:07:20.633572 trace git-lfs: exec: uname
13:07:20.664992 trace git-lfs: exec: git 'config' '--includes' '-l'
13:07:20.680763 trace git-lfs: exec: git 'rev-parse' '--is-bare-repository'
13:07:20.696471 trace git-lfs: exec: git 'config' '--includes' '-l' '--blob' ':.lfsconfig'
13:07:20.712601 trace git-lfs: exec: git 'config' '--includes' '-l' '--blob' 'HEAD:.lfsconfig'
13:07:20.728453 trace git-lfs: attempting pure SSH protocol connection
13:07:20.728956 trace git-lfs: run_command: ssh -oControlMaster=auto -oControlPath=C:\Users\MICHAE~1\AppData\Local\Temp\sock-1505662046\sock-%C git@bitbucket.org git-lfs-transfer michael_thx/lfs-auth-ssh-issue.git upload
13:07:20.735051 trace git-lfs: exec: ssh '-oControlMaster=auto' '-oControlPath=C:\Users\MICHAE~1\AppData\Local\Temp\sock-1505662046\sock-%C' 'git@bitbucket.org' 'git-lfs-transfer michael_thx/lfs-auth-ssh-issue.git upload'
13:07:20.759777 trace git-lfs: pure SSH protocol connection failed: Unable to negotiate version with remote side (unable to read capabilities): EOF
13:07:20.760617 trace git-lfs: pre-push: refs/heads/master 7fa39d52acb51d4e34393b3b6afc559fb343da2d refs/heads/master 5bf600c8130a63a81f909f62d281108acecebc6d
13:07:20.760617 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'show-ref'
13:07:20.791762 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'ls-remote' '--heads' '--tags' '-q' 'origin'
13:07:25.979460 trace git-lfs: attempting pure SSH protocol connection
13:07:25.980075 trace git-lfs: run_command: ssh -oControlMaster=auto -oControlPath=C:\Users\MICHAE~1\AppData\Local\Temp\sock-2198785769\sock-%C git@bitbucket.org git-lfs-transfer michael_thx/lfs-auth-ssh-issue.git upload
13:07:25.987952 trace git-lfs: exec: ssh '-oControlMaster=auto' '-oControlPath=C:\Users\MICHAE~1\AppData\Local\Temp\sock-2198785769\sock-%C' 'git@bitbucket.org' 'git-lfs-transfer michael_thx/lfs-auth-ssh-issue.git upload'
13:07:26.010250 trace git-lfs: pure SSH protocol connection failed: Unable to negotiate version with remote side (unable to read capabilities): EOF
13:07:26.010250 trace git-lfs: run_command: ssh git@bitbucket.org git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload
13:07:26.010250 trace git-lfs: exec: ssh 'git@bitbucket.org' 'git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload'
13:12:53.251588 trace git-lfs: filepathfilter: creating pattern ".git" of type gitignore
13:12:53.251588 trace git-lfs: filepathfilter: creating pattern "**/.git" of type gitignore
13:12:53.252124 trace git-lfs: filepathfilter: accepting "tmp"
Exiting because of "interrupt" signal.
The "interrupt" is me hitting Ctrl-C. I've let it wait overnight and after about 6 hours... the connection is reset
C:\src\lfs-ssh-issue\lfs-auth-ssh-issue [master ↑2]> git push
00:30:22.854519 exec-cmd.c:243 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
00:30:22.854519 git.c:462 trace: built-in: git push
00:30:22.854519 run-command.c:661 trace: run_command: unset GIT_PREFIX; ssh git@bitbucket.org 'git-receive-pack '\''michael_thx/lfs-auth-ssh-issue.git'\'''
00:30:26.222016 run-command.c:661 trace: run_command: .git/hooks/pre-push origin git@bitbucket.org:michael_thx/lfs-auth-ssh-issue.git
00:30:26.269828 exec-cmd.c:243 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
00:30:26.269828 git.c:748 trace: exec: git-lfs pre-push origin git@bitbucket.org:michael_thx/lfs-auth-ssh-issue.git
00:30:26.269828 run-command.c:661 trace: run_command: git-lfs pre-push origin git@bitbucket.org:michael_thx/lfs-auth-ssh-issue.git
00:30:26.284632 trace git-lfs: exec: git 'version'
00:30:26.310622 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'remote' '-v'
00:30:26.332469 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'remote'
00:30:26.348189 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-parse' 'HEAD' '--symbolic-full-name' 'HEAD'
00:30:26.364258 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-parse' '--git-dir' '--show-toplevel'
00:30:26.381508 trace git-lfs: exec: uname
00:30:26.428441 trace git-lfs: exec: git 'config' '--includes' '-l'
00:30:26.443715 trace git-lfs: exec: git 'rev-parse' '--is-bare-repository'
00:30:26.459701 trace git-lfs: exec: git 'config' '--includes' '-l' '--blob' ':.lfsconfig'
00:30:26.475625 trace git-lfs: exec: git 'config' '--includes' '-l' '--blob' 'HEAD:.lfsconfig'
00:30:26.492182 trace git-lfs: attempting pure SSH protocol connection
00:30:26.492708 trace git-lfs: run_command: ssh -oControlMaster=auto -oControlPath=C:\Users\MICHAE~1\AppData\Local\Temp\sock-3854338605\sock-%C git@bitbucket.org git-lfs-transfer michael_thx/lfs-auth-ssh-issue.git upload
00:30:26.496480 trace git-lfs: exec: ssh '-oControlMaster=auto' '-oControlPath=C:\Users\MICHAE~1\AppData\Local\Temp\sock-3854338605\sock-%C' 'git@bitbucket.org' 'git-lfs-transfer michael_thx/lfs-auth-ssh-issue.git upload'
00:30:26.523235 trace git-lfs: pure SSH protocol connection failed: Unable to negotiate version with remote side (unable to read capabilities): EOF
00:30:26.523888 trace git-lfs: pre-push: refs/heads/master 7fa39d52acb51d4e34393b3b6afc559fb343da2d refs/heads/master 5bf600c8130a63a81f909f62d281108acecebc6d
00:30:26.523888 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'show-ref'
00:30:26.554562 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'ls-remote' '--heads' '--tags' '-q' 'origin'
00:30:30.118578 trace git-lfs: attempting pure SSH protocol connection
00:30:30.118578 trace git-lfs: run_command: ssh -oControlMaster=auto -oControlPath=C:\Users\MICHAE~1\AppData\Local\Temp\sock-3187652663\sock-%C git@bitbucket.org git-lfs-transfer michael_thx/lfs-auth-ssh-issue.git upload
00:30:30.122456 trace git-lfs: exec: ssh '-oControlMaster=auto' '-oControlPath=C:\Users\MICHAE~1\AppData\Local\Temp\sock-3187652663\sock-%C' 'git@bitbucket.org' 'git-lfs-transfer michael_thx/lfs-auth-ssh-issue.git upload'
00:30:30.149989 trace git-lfs: pure SSH protocol connection failed: Unable to negotiate version with remote side (unable to read capabilities): EOF
00:30:30.149989 trace git-lfs: run_command: ssh git@bitbucket.org git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload
00:30:30.153720 trace git-lfs: exec: ssh 'git@bitbucket.org' 'git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload'
client_loop: send disconnect: Connection reset
06:17:17.544048 trace git-lfs: ssh: git@bitbucket.org failed, error: exit status 255, message: client_loop: send disconnect: Connection reset (try: 0/6)
06:17:17.544048 trace git-lfs: run_command: ssh git@bitbucket.org git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload
06:17:17.561435 trace git-lfs: exec: ssh 'git@bitbucket.org' 'git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload'
06:18:20.599643 trace git-lfs: ssh: git@bitbucket.org failed, error: exit status 255, message: sign_and_send_pubkey: signing failed for RSA "(none)" from agent: agent refused operation
git@bitbucket.org: Permission denied (publickey). (try: 1/6)
06:18:20.599918 trace git-lfs: run_command: ssh git@bitbucket.org git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload
06:18:20.606454 trace git-lfs: exec: ssh 'git@bitbucket.org' 'git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload'
06:19:22.522672 trace git-lfs: ssh: git@bitbucket.org failed, error: exit status 255, message: sign_and_send_pubkey: signing failed for RSA "(none)" from agent: agent refused operation
git@bitbucket.org: Permission denied (publickey). (try: 2/6)
06:19:22.522672 trace git-lfs: run_command: ssh git@bitbucket.org git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload
06:19:22.527056 trace git-lfs: exec: ssh 'git@bitbucket.org' 'git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload'
06:20:24.471788 trace git-lfs: ssh: git@bitbucket.org failed, error: exit status 255, message: sign_and_send_pubkey: signing failed for RSA "(none)" from agent: agent refused operation
git@bitbucket.org: Permission denied (publickey). (try: 3/6)
06:20:24.472168 trace git-lfs: run_command: ssh git@bitbucket.org git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload
06:20:24.477505 trace git-lfs: exec: ssh 'git@bitbucket.org' 'git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload'
06:21:26.371207 trace git-lfs: ssh: git@bitbucket.org failed, error: exit status 255, message: sign_and_send_pubkey: signing failed for RSA "(none)" from agent: agent refused operation
git@bitbucket.org: Permission denied (publickey). (try: 4/6)
06:21:26.371394 trace git-lfs: run_command: ssh git@bitbucket.org git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload
06:21:26.375917 trace git-lfs: exec: ssh 'git@bitbucket.org' 'git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload'
06:22:28.285033 trace git-lfs: ssh: git@bitbucket.org failed, error: exit status 255, message: sign_and_send_pubkey: signing failed for RSA "(none)" from agent: agent refused operation
git@bitbucket.org: Permission denied (publickey). (try: 5/6)
Remote "origin" does not support the Git LFS locking API. Consider disabling it with:
$ git config lfs.https
/bitbucket.org/michael_thx/lfs-auth-ssh-issue.git/info/lfs.locksverify false
06:22:28.285286 trace git-lfs: tq: running as batched queue, batch size of 100
06:22:28.285792 trace git-lfs: run_command: git rev-list --objects --ignore-missing --stdin --
06:22:28.286307 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-list' '--objects' '--ignore-missing' '--stdin' '--'
06:22:28.296764 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'cat-file' '--batch-check'
06:22:28.299105 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-parse' '--git-common-dir'
06:22:28.328367 trace git-lfs: tq: sending batch of size 1
06:22:28.328434 trace git-lfs: run_command: ssh git@bitbucket.org git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload
06:22:28.332131 trace git-lfs: exec: ssh 'git@bitbucket.org' 'git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload'
06:23:30.226909 trace git-lfs: ssh: git@bitbucket.org failed, error: exit status 255, message: sign_and_send_pubkey: signing failed for RSA "(none)" from agent: agent refused operation
git@bitbucket.org: Permission denied (publickey). (try: 0/6)
06:23:30.227101 trace git-lfs: run_command: ssh git@bitbucket.org git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload
06:23:30.230604 trace git-lfs: exec: ssh 'git@bitbucket.org' 'git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload'
06:24:32.160284 trace git-lfs: ssh: git@bitbucket.org failed, error: exit status 255, message: sign_and_send_pubkey: signing failed for RSA "(none)" from agent: agent refused operation
git@bitbucket.org: Permission denied (publickey). (try: 1/6)
06:24:32.160284 trace git-lfs: run_command: ssh git@bitbucket.org git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload
06:24:32.164438 trace git-lfs: exec: ssh 'git@bitbucket.org' 'git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload'
06:25:34.102833 trace git-lfs: ssh: git@bitbucket.org failed, error: exit status 255, message: sign_and_send_pubkey: signing failed for RSA "(none)" from agent: agent refused operation
git@bitbucket.org: Permission denied (publickey). (try: 2/6)
06:25:34.102833 trace git-lfs: run_command: ssh git@bitbucket.org git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload
06:25:34.107056 trace git-lfs: exec: ssh 'git@bitbucket.org' 'git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload'
06:26:36.032464 trace git-lfs: ssh: git@bitbucket.org failed, error: exit status 255, message: sign_and_send_pubkey: signing failed for RSA "(none)" from agent: agent refused operation
git@bitbucket.org: Permission denied (publickey). (try: 3/6)
06:26:36.032867 trace git-lfs: run_command: ssh git@bitbucket.org git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload
06:26:36.037263 trace git-lfs: exec: ssh 'git@bitbucket.org' 'git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload'
06:27:37.973663 trace git-lfs: ssh: git@bitbucket.org failed, error: exit status 255, message: sign_and_send_pubkey: signing failed for RSA "(none)" from agent: agent refused operation
git@bitbucket.org: Permission denied (publickey). (try: 4/6)
06:27:37.973888 trace git-lfs: run_command: ssh git@bitbucket.org git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload
06:27:37.977955 trace git-lfs: exec: ssh 'git@bitbucket.org' 'git-lfs-authenticate michael_thx/lfs-auth-ssh-issue.git upload'
06:28:39.882160 trace git-lfs: ssh: git@bitbucket.org failed, error: exit status 255, message: sign_and_send_pubkey: signing failed for RSA "(none)" from agent: agent refused operation
git@bitbucket.org: Permission denied (publickey). (try: 5/6)
batch request: sign_and_send_pubkey: signing failed for RSA "(none)" from agent: agent refused operation
git@bitbucket.org: Permission denied (publickey).: exit status 255
Uploading LFS objects: 0% (0/1), 0 B | 0 B/s, done.
error: failed to push some refs to 'bitbucket.org:michael_thx/lfs-auth-ssh-issue.git'
fatal: unable to write flush packet: Broken pipe
C:\src\lfs-ssh-issue\lfs-auth-ssh-issue [master ↑2]> kkejknhdipp^C
C:\src\lfs-ssh-issue\lfs-auth-ssh-issue [master ↑2]> git status
12:54:29.932442 exec-cmd.c:243 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
12:54:29.932442 git.c:462 trace: built-in: git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
C:\src\lfs-ssh-issue\lfs-auth-ssh-issue [master ↑2]> git remote -v
12:54:35.090542 exec-cmd.c:243 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
12:54:35.092608 git.c:462 trace: built-in: git remote -v
origin git@bitbucket.org:michael_thx/lfs-auth-ssh-issue.git (fetch)
origin git@bitbucket.org:michael_thx/lfs-auth-ssh-issue.git (push)
C:\src\lfs-ssh-issue\lfs-auth-ssh-issue [master ↑2]>