简体   繁体   中英

Staged git lfs files not being intercepted by git-lfs

I am trying to commit/push a 1.2gb tar file to git lfs server using Git on Windows 10

I have tracked the tar extension with:

C:\FilepathTo\Folder> git lfs track '*.tar'

Running git lfs track returns

Listing tracked patterns
    Folder\'*.tar' (Folder\.gitattributes)

I add the .gitattributes file

C:\FilepathTo\Folder> git add .gitattributes

I add the large file

C:\FilepathTo\Folder> git add file.tar  

Then confirm the file is being tracked with

C:\FilepathTo\Folder> git lfs status

    On branch MyAwesomeBranch
    Git LFS objects to be pushed to origin/MyAwesomeBranch:


    Git LFS objects to be committed:

            .gitattributes  (Git: 136g1ea)
            file.tar (Git: 567d1ed)

    Git LFS objects not staged for commit:

I commit the file

C:\FilepathTo\Folder> git commit -m "foo"
    [MyAwesomeBranch ecf9735] foo
     2 files changed, 0 insertions(+), 0 deletions(-)
     create mode 100644 Folder/.gitattributes
     create mode 100644 Folder/file.tar

And check that the file is being tracked

C:\FilepathTo\Folder> git lfs track ls-files

Which returns nothing.

I check lfs status again and it isn't listed as an object to be pushed.

C:\FilepathTo\Folder> git lfs status
On branch MyAwesomeBranch
Git LFS objects to be pushed to origin/MyAwesomeBranch:


Git LFS objects to be committed:


Git LFS objects not staged for commit:

As expected, pushing fails with

remote: error: File Folder/file.tar is 1229.43 MB; this exceeds GitHub Enterprise's file size limit of 100.00 MB

What am i doing wrong? Why is the staged file not being committed to git lfs?

The issue was resolved. This command was the issue:

C:\FilepathTo\Folder> git lfs track '*.tar'

I should have used double quotes as below:

C:\FilepathTo\Folder> git lfs track "*.tar"

Which resolved my issue.

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