简体   繁体   中英

Cannot Push png files to Github Repository LFS Error

I have been pushing png and image files fine to github. Now, I get an error.

My set up: Windows + Visual Studio Code + git bash for terminal

This is my.git/config file

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
[credential]
    helper = store
[lfs "https://github.com/ryan/restart.git/info/lfs"]
    locksverify = false
[remote "origin"]
    url = https://github.com/ryan/restart.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "main"]
    remote = origin
    merge = refs/heads/main

So I add an image to my repository.

I do

git add .
git commit
git push

This is what git push results:

guestaccount@LAPTOP-4G5S6I9K MINGW64 /c/xampp7.2/htdocs/folder2-temp (main)
$ git push
Enter passphrase for key '/c/Users/guestaccount/.ssh/id_rsa': 
Uploading LFS objects:   0% (0/1), 0 B | 0 B/s

I always seem to get stuck here then this shows:

$ git push
Enter passphrase for key '/c/Users/guestaccount/.ssh/id_rsa': 
batch request: ssh: connect to host github.com port 22: Connection timed out: exit status 255
error: failed to push some refs to 'ssh://github.com/ryan/restart.git'

I have been asking how to switch from SSH to https in order to solve the problem, but it seems that's not the issue.

Cannot reset github from ssh to https

So, basically how do I upload png files again? This particular png file is only 46KB so github should be able to push it.

I encountered the same issue (stuck on "Uploading LFS objects"). Further investigating, setting the environment variables GIT_TRACE=1 and GIT_TRANSFER_TRACE=1 .

I noticed that the git is stuck at the following:

run_command: C:\WINDOWS\System32\OpenSSH\ssh.exe -- git@my-git-domain.com git-lfs-authenticate my-git-repository.git upload
trace git-lfs: exec: C:\WINDOWS\System32\OpenSSH\ssh.exe '--' 'git@my-git-domain.com' 'git-lfs-authenticate my-git-repository.git upload'

Surprisingly, running the following command successfully returned and displayed my authorization header.

C:\WINDOWS\System32\OpenSSH\ssh.exe -- git@my-git-domain.com git-lfs-authenticate my-git-repository.git upload

Turns out that the shipped Win10 ssh client has a bug and downloading a new version and setting the following environment variable resolved the issue.

GIT_SSH=C:\MyPath\to\the\new\ssh.exe

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM