Git LFS文件没有推送到远程仓库

时间:2019-08-29 17:47:00

标签: git atlassian-sourcetree bitbucket-server git-lfs

我正在尝试使用git LFS将xlsx文件推送到远程存储库。

我尝试了两种方法:使用Sourcetree单击菜单和使用终端服务器。两者都导致相同的错误消息。

我在Bitbucket中设置了一个远程仓库,并设置了允许LFS选项。我将空存储库克隆到本地文件位置。

在Sourcetree中,我使用了Repository / Git LFS / Initizalise存储库。这给了我一个点击菜单来设置gitattributes文件,我将其设置为允许xlsx文件(* .xlsx)。我提交并推送了自动创建的gitattributes文件。然后,我将Excel文件移到本地文件夹中,提交并尝试推送。

在终端窗口中,我使用了几乎相同的方法-克隆空的远程仓库,然后执行git lfs install,git lfs track“ * .xlsx”,提交并推送gitattributes文件,然后添加并提交Excel文件。

当我尝试推入Sourcetree或使用终端时,我得到了相同的错误消息:

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

这会导致错误消息

2 个答案:

答案 0 :(得分:0)

  • 我为解决该问题而采取的步骤:

1-查看状态

git lfs状态

2-获取所有对象

git lfs获取--all

3-允许不完全推送,默认情况下为“ false”

git config --global lfs.allowincompletepush true

4- Git push-全部以某种方式强制执行

git lfs push-所有原始主机

4-如果您某种方式拥有未拉出的数据,则可能需要:

git lfs拉 git push

5-如果没有任何效果,请尝试:

git push -f --no-verify

请勿使用VPN或代理

答案 1 :(得分:0)

我用 BitBucket 遇到了这个问题,解决方案是

git config --global lfs.contenttype 0

我从this thread那里得到了这个想法。