Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Migrating from Server to Cloud and switching to LFS

I am currently running a Bitbucket Server instance and I'm in the process of migrating it to the cloud.

The repo has steadily grown over the last few years and is now ~2.5Gb in size, so this seems like a good time to switch to LFS.

Unfortunately, the larger files in the repo are required and I'd rather not lose the history.

From what I've read so far, the best way to convert to LFS is to use BFG, so my main question is, what is the best order to do things in?

  1. Import the current repo into the cloud and then convert to LFS.
  2. Convert the current repo to LFS and then import into the cloud.
  3. Somehow import and convert simultaneously (this would be awesome, but I don't think it's possible).

From the moment I start the process until the moment it is complete, the programmers aren't going to be able to access the repo and they'll have to check-out the new repo when it's all done, so I'm aiming for the safest option with the least down-time.  I'm thinking this will be me working after everybody has committed all their changes and signed off for the day.

One side note - I ran a test import/convert (using option 1) and the result was that the repo still claimed to be taking up a ton of space and I also needed a ton of storage.  I've seen a few posts mention that I may need to contact Atlassian support about running a garbage collection to clear this up.

I look forward to hearing your suggestions/comments/ideas/feedback.

1 answer

0 votes

Hi Charles,

I'm afraid that the importer in Bitbucket Cloud does not import LFS objects.

My suggestion would be the following:

  1. Take a mirror clone of the repo from the Bitbucket Server instance
  2. Convert it to LFS
  3. Create a new empty repo in Bitbucket Cloud, and push the converted repository to the empty Bitbucket Cloud repo

You can double check whether the LFS objects have been pushed if you go to Repository settings (in Bitbucket website) > Git LFS.

I suggest running also the following command inside the converted repo, after you use BFG and prior to pushing it

git reflog expire --expire=now --all && git gc --prune=now --aggressive

and then you can check the size of the local converted repo with

git count-objects -Hv

The sum of the fields size-pack and size in the output will give you the size of the git repo. If this differs from the size you see in the remote, you can open a ticket with the support team to run a git gc on the repo.

If you have any questions, please feel free to let me know!

Kind regards,

Suggest an answer

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

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,850 views 10 16
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