Use Git Lfs with existing Bitbucket Repository

Sep 28, 2019 · 2 mins read · Post a comment
Use Git Lfs with existing Bitbucket Repository

Git LFS allows users to save space by storing binary files in a different location, so in this tutorial I’m going to show you how can you operate and manage your repo with Git LFS.


  • GIT Installed
  • Bitbucket account and repository

Installing Git LFS

In this tutorial, we will use Centos 7 as a host machine to install and work with git lfs. Before installing git lfs, we need to make sure that git is already installed on your machine. To check this, run:

sudo git --version

You should see the output like below:

Output: git version

Next, install the epel repo by running the following command:

sudo yum install epel-release

To install the git-lfs repo, run:

curl -s | sudo bash

And finally:

sudo yum install git-lfs

That’s it, we successfully installed git-lfs.

Clone Bitbucket repo with Git LFS

Step 1. Log in to your Bitbucket account, navigate to the Repositories and open it.

Open Bibtbucket Repo

Next, we will clone that repo to our Centos 7 machine.

Step 2. Create a directory project and navigate to that directory using the following commands:

sudo mkdir ~/project
sudo cd ~/project/

Now you should clone your repository to the local machine.

sudo git clone

If you receive the follwoing error:

Permission denied (publickey).
fatal: Could not read from remote repository.

you need to set up SSH keys and configure it with Bitbucket.

Step 2. From your project directory initialize git lfs.

sudo git lfs install

Fetch the LFS objects for the current ref from default remote.

sudo git lfs fetch

And now download Git LFS objects for the currently checked out ref.

sudo git lfs pull


In this tutorial, we shown you how to use git lfs with Bitbucket repository. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.