Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] Git LFS and Push



On Sat, May 21, 2016 at 5:06 PM, Jacob Wang <jatcwang@xxxxxxxxx> wrote:
On 05/21/2016 06:42 PM, Matthias Sohn wrote:
On Sat, May 21, 2016 at 7:30 AM, Jacob Wang <jatcwang@xxxxxxxxx> wrote:
Hi,

I am currently writing an application which utilizes JGit and its LFS capabilities.

Most actions related to LFS seems to work, like AddCommand (runs through the LFS filter) and Clone/Checkout.

However running Push doesn't seem to push the LFS object into the LFS storage.

My .gitattributes file:

===

* filter=lfs diff=lfs merge=lfs -text
.gitattributes -filter -text -diff -merge
_content -filter -text -diff -merge

===

and here's my .git/config

===

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    url = "" href="https://jatcwang1.visualstudio.com/_git/lfstest" rel="noreferrer" target="_blank">https://jatcwang1.visualstudio.com/_git/lfstest
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
[lfs "https://jatcwang1.visualstudio.com/_git/lfstest.git/info/lfs"]
    access = basic

===

On a side note, I have git-lfs installed, but I removed hooks/pre-push (which runs git-lfs for uploading files) before I ran PushCommand, to test that it successfully uploads the file to the large file storage.

What am I missing to get file upload on Push to work? Thanks

don't remove the pre-push hook :-) 

JGit still depends on git-lfs, it must be installed, configured and reachable in the PATH seen by JGit.
We now have support for gitattributes and JGit learned to run external clean and smudge filters
and how to trigger the pre-push hook.

We are working on a built-in implementation of git-lfs in JGit but that's not yet ready, see [1].


-Matthias

Ah cool, thanks for the answer Matthias.

The reason why I removed the pre-push hook was because the authentication creds I'm using with the PushCommand doesn't seem to be used by the git-lfs binary, which leads to auth failure for git-lfs when it tries to upload the file. Is there a way to share or set the credentials to git-lfs?

you may use a git credentials helper 

I had a quick look at the link you provided and I'm slightly confused - it seems like the topic branch only just implemented clean and smudge filter, but it seems to work for me already when I run the Checkout/Add command. Am I missing something here?

it works if you have git-lfs installed and on the path which provides the filter implementations.
With the changes I linked JGit will get it's own built-in lfs implementation so that installation of
git-lfs and native git (git-lfs is using that) isn't needed anymore.

-Matthias


Back to the top