Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Importing repository in Azure DevOps with Git LFS

I am trying to migrate Bitbucket repositories to DevOps using the import repository function in DevOps. Some of those repositories have LFS enabled, and it looks like DevOps does not import the LFS files since when I clone the repo I got a lot of LFS errors. I tried to download a zip file of a commit, and while it should be around 12GB with all the files it was just over 600MB.

Does anyone know how to import repositories in DevOps with LFS enabled correctly?

like image 790
oererik Avatar asked Oct 28 '25 06:10

oererik


1 Answers

What if my source repository contains Git LFS objects?

Git import will not import Git LFS objects.

LFS objects can be moved using the following steps:

  • Import the repository using import repository feature into Azure DevOps. This will copy over all the Git objects from source to Azure DevOps (this will also import the LFS pointers which are Git objects but not the LFS files)

To move over the LFS files (you will need both Git.exe and LFS client in the same box and access to both source repository and destination repository)

  • Clone the imported repository from Azure DevOps to local system, clone will work but it will fail while performing checkout of LFS files
  • Add the source repository as remote (say ‘source’) git remote add source <SOURCE_URL>
  • Perform git lfs fetch source -–all (this will bring over all LFS files from source to your local repository)
  • Assuming the destination VSTS repository is your ‘target’ remote
  • Perform git lfs push target -–all

https://learn.microsoft.com/en-us/azure/devops/repos/git/import-git-repository?view=azure-devops#what-if-my-source-repository-contains-git-lfs-objects

like image 140
stuartdotnet Avatar answered Oct 29 '25 20:10

stuartdotnet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!