How to checkout a Bitbucket Git-LFS repo in Jenkins GUI?

1,303 views
Skip to first unread message

ZillaYT

unread,
Jun 22, 2018, 5:27:59 PM6/22/18
to Jenkins Users

I have a Git LFS setup on our Bitbucket server, and can clone it on my Mac since I'm the owner.


I have the Git plugin installed in Jenkins, which includes GitLFS, and have Git LFS installed on my slaves.


Now I'm trying to set this up so a Jenkins job can clone the repo, and so on the Configure->SCM section I have

Repository URL: g...@server.company.com:user/path/repo.git
Credentials: uernamePwCreds


It can get to the repo fine, but when it tries to checkout a Git-LFS file, it gets the following access error. See the Permission denied (publickey) error on last line.

FATAL: Could not checkout 104e35fb26dc1d3ed1689523cccb6e97829c0feb
hudson.plugins.git.GitException: Command "git checkout -f 104e35fb26dc1d3ed1689523cccb6e97829c0feb" returned status code 128:
stdout: 
stderr: Downloading MarcomLite/lib/jets3t-0.6.1/cockpit-0.6.1.jar (144 KB)
Error downloading object: MarcomLite/lib/jets3t-0.6.1/cockpit-0.6.1.jar (716be41): Smudge error: Error downloading MarcomLite/lib/jets3t-0.6.1/cockpit-0.6.1.jar (716be4107b362e413dc1ae29dc88e9b79e680def2c725ecc2d73268c4ea66e75): batch request: Permission denied (publickey).: exit status 255


How do I setup the "Git-LFS-specific" level authentication? I don't want to use a Jenkinsfile just yet.


I see https://github.com/git-lfs/git-lfs/blob/master/docs/api/server-discovery.md, but don't know how to apply it in the Jenkins GUI.


I'm sure someone has done this before? (I hope.)


Thanks,

Chris

Mark Waite

unread,
Jun 22, 2018, 5:39:02 PM6/22/18
to jenkins...@googlegroups.com
The credential you listed had the name "uernamePwCreds" and is associated with a Git URL that uses ssh private key authentication.  If the name of that credential matches its contents, then the credential contains a username and a password.  That won't work with a Git URL that uses ssh private key authentication.

You need to use an ssh private key credential with the ssh private key URL.

Alternately (and likely preferred for Git LFS), you could use a username / password credential and the https URL to the repository (instead of the ssh URL to the repository).

If this is a Freestyle job, then the git configuration of the job will also need the "Additional Behaviour" added for "Git LFS pull after checkout".

If this is a Pipeline job, then the checkout definition will need to include the Git LFS pull after checkout additional behavior.  See my example for more information.

Mark Waite

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/85f37ac7-ee7a-4517-af2b-e849d1f92d73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages