Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git LFS files not pushing to remote repo

I'm trying to push an xlsx file to a remote repository using git LFS.

I've tried two ways: Using Sourcetree click-thru menus and using the terminal server. Both result in the same error message.

I set up a remote repo in Bitbucket and set the Allow LFS option. I cloned the empty repo to a local file location.

In Sourcetree, I used Repository/Git LFS/Initizalise repo. This gave me a click-thru menu to set up a gitattributes file, which I set to allow xlsx files (*.xlsx) . I committed and pushed the gitattributes file which was automatically created. Then I moved the Excel file into the local folder, committed, and tried to push.

In the terminal window, I used much the same approach--cloning the empty remote repo, then doing git lfs install, git lfs track "*.xlsx", committing and pushing the gitattributes file, and then adding and committing the Excel file.

When I tried to push in either Sourcetree or using the terminal, I got the same error message:

Uploading LFS objects:   0% (0/1), 0 B | 0 B/s, done
Fatal error: null
error: failed to push some refs to 'remote_repo_location'


git clone remote_repo
cd remote_repo
git init
git lfs install
git lfs track "*.xlsx"
git add -A
git commit -m "test"
git push origin master 

(this works fine and puts the gitattributes file in my remote repo)

Then I physically copy the Excel file into the folder and do this:
git add -A
git commit -m "test2"
git push origin master

This causes the error message

like image 410
Jenna Spirt Avatar asked Oct 23 '25 08:10

Jenna Spirt


2 Answers

Here's the steps you can try:

  1. View the status
$ git lfs status
  1. Fetch all objects
$ git lfs fetch --all
  1. Allowing incomplete push, It is "false" by default
$ git config --global lfs.allowincompletepush true
  1. Git push -all to somehow forces the push
$ git lfs push --all origin master
  1. If somehow you have un-pulled data you might want to:
$ git lfs pull
$ git push
  1. If nothing works, just try:
$ git push -f --no-verify

NOTE: DO NOT PUSH ON A VPN NOR A PROXY

like image 137
Amine Hammou Avatar answered Oct 25 '25 08:10

Amine Hammou


I hit this problem with BitBucket, and the solution was

git config --global lfs.contenttype 0

I got the idea from this thread.

like image 25
kakyo Avatar answered Oct 25 '25 07:10

kakyo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!