简体   繁体   English

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

[英]Git LFS files not pushing to remote repo

I'm trying to push an xlsx file to a remote repository using git LFS.我正在尝试使用 git LFS 将 xlsx 文件推送到远程存储库。

I've tried two ways: Using Sourcetree click-thru menus and using the terminal server.我尝试了两种方法:使用 Sourcetree click-thru 菜单和使用终端服务器。 Both result in the same error message.两者都会导致相同的错误消息。

I set up a remote repo in Bitbucket and set the Allow LFS option.我在 Bitbucket 中设置了一个远程仓库并设置了 Allow LFS 选项。 I cloned the empty repo to a local file location.我将空的 repo 克隆到本地文件位置。

In Sourcetree, I used Repository/Git LFS/Initizalise repo.在 Sourcetree 中,我使用了 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) .这给了我一个点击菜单来设置 gitattributes 文件,我将其设置为允许 xlsx files (*.xlsx) 。 I committed and pushed the gitattributes file which was automatically created.我提交并推送了自动创建的 gitattributes 文件。 Then I moved the Excel file into the local folder, committed, and tried to push.然后我将 Excel 文件移动到本地文件夹中,提交,并尝试推送。

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

When I tried to push in either Sourcetree or using the terminal, I got the same error message:当我尝试推送 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

This causes the error message这会导致错误消息

  • Steps I produced to solve the problem:我为解决问题而制作的步骤:

1- View the status 1-查看状态

git lfs status git lfs 状态

2- Fetch all objects 2- 获取所有对象

git lfs fetch --all git lfs fetch --all

3- Allowing incomplete push, It is "false" by default 3- 允许不完全推送,默认为“false”

git config --global lfs.allowincompletepush true git config --global lfs.allowincompletepush true

4- Git push -all to somehow forces the push 4- Git push -all 以某种方式强制推送

git lfs push --all origin master git lfs push --all origin master

4- If somehow you have un-pulled data you might want to: 4- 如果不知何故您有未提取的数据,您可能想要:

git lfs pull git push git lfs 拉 git 推

5- If nothing works, just try: 5- 如果没有任何效果,请尝试:

git push -f --no-verify git push -f --no-verify

DO NOT PUSH ON A VPN NOR A PROXY请勿使用 VPN 或代理

I hit this problem with BitBucket, and the solution was我用 BitBucket 遇到了这个问题,解决方案是

git config --global lfs.contenttype 0

I got the idea from this thread .我从这个线程中得到了这个想法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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