Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to move a repo with git lfs to a new project?

I've got a couple of git repos that have `git lfs` turned on and I'd like to move them to a new project in Bitbucket. However bitbucket is telling me that I cann't move them because of `git lfs` support, why is that and what can I do about it. 

BTW, I'm not really sure that these repos really need `git lfs` support as the files in lfs are only a couple of MB each. 

1 answer

1 accepted

0 votes
Answer accepted
Caroline R Atlassian Team Nov 04, 2021

Hi, @Matt Schuckmann

Thank you for reaching out to Atlassian Community!

Currently, the transfer of repositories with Git LFS files is disabled, this is a limitation for Git LFS. However, we have a workaround for that:

Instead of transferring the repo, you can clone the repo to your local machine, then create a repo in Bitbucket, and push to that.

When you do this, all files and the Git history will be available in the new repo, but the metadata for such things as issues, pull requests won't be copied over. Furthermore, you'll have to set up users and access permissions for the new repo.

  1. Clone the Git LFS repo to your local machine as usual:

  2. Fetch the Git LFS history:

    git lfs fetch --all origin
  3. Create a new repo in Bitbucket. 

  4. Add a remote locally that points to the new repo:

    git remote add new-origin <URL to new repo>
  5. Now push to the new repo:

    git push -u new-origin --all

    This pushes the repo and its refs for the first time.

  6. Push Git LFS data to the new repo:

    git lfs push --all new-origin
  7. Finally, update the remotes for the new repo:

    git remote set-url origin <URL to new repo>
    git remote set-url --push origin <URL to new repo>

Please let me know how it goes and feel free to share any additional questions or concerns regarding this case. 

Kind regards,

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,255 views 2 9
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you