【问题标题】:Git LFS files not pushing to remote repoGit LFS 文件未推送到远程仓库
【发布时间】:2020-01-03 01:00:39
【问题描述】:

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

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

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

在 Sourcetree 中,我使用了 Repository/Git LFS/Initizalise repo。这给了我一个点击菜单来设置一个 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

这会导致错误消息

【问题讨论】:

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


    【解决方案1】:
    • 我为解决问题而制定的步骤:

    1- 查看状态

    git lfs 状态

    2- 获取所有对象

    git lfs fetch --all

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

    git config --global lfs.allowincompletepush true

    4- Git push -all 以某种方式强制推送

    git lfs push --all origin master

    4- 如果您有未提取的数据,您可能希望:

    git lfs 拉 git推送

    5- 如果不起作用,请尝试:

    git push -f --no-verify

    不要推送 VPN 或代理

    【讨论】:

    • 请您详细说明“请勿使用 VPN 或代理”背后的动机吗?
    【解决方案2】:

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

    git config --global lfs.contenttype 0
    

    我的想法来自this thread

    【讨论】:

      猜你喜欢
      • 2013-02-21
      • 2014-10-21
      • 2015-08-29
      • 2014-12-22
      • 1970-01-01
      • 2019-06-29
      • 2020-11-27
      • 1970-01-01
      • 2022-01-23
      相关资源
      最近更新 更多