Bitbucket LFS Permission denied (SSH command) Edited

Hi everyone,

I have a bash script that run commands on a windows machine (lets call it machine A) to pull a repository on bitbucket (using git) and then run specific programs to work on the pulled content.

I have also a ubuntu machine running Jenkins. On a build step I use the "Publish Over SSH" plugin to run the bash script on the machine A.

Everything goes fine all the times unless git has to pull a commit containing a large file and its fails with this error :

Downloading test x_map.fbx (31 MB) Error downloading object: x_map.fbx (63b3f85): Smudge error: Error downloading x_map.fb x (hash): batch request: Permission denied (publickey).: exit status 255

The problem is that the LFS part of git doesn't use the SSH key even though I did set the core.sshCommand in git config to use a key for all the ssh commands.

So when I do this : ssh git-lfs-authenticate "reopsitory" downlaod its fails with this message : Permission denied (publickey)

But it works fine when I run it with the ssh key option : ssh -i "ssh-key-path" git-lfs-authenticate "reopsitory" downlaod

So I was wondering if there was any solution to kind of overload all the LFS ssh commands to use a specific ssh key like the core.sshCommand in git config.

I m hardly stuck on this so I hope you guys have a miraculous solution! Thanks in advance for your help.

adding prior to the git pull command :
eval $(ssh-agent -s)
ssh-add "key-path" makes this command work : [  ssh git-lfs-authenticate "reopsitory" downlaod ] but the git pull still fails with the same error

1 answer

0 vote

Hi Ridha! The git pull command failing can be related to a ton of things but, looking at the information you provide it seems that maybe the git remote -v is not pointing to the right place.

Also, could you let us know if the environment that you're using to pull LFS is the same you're using to push?

Best regards,


Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

23,237 views 26 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you