简体   繁体   English

使用 Git LFS 在 Azure DevOps 中导入存储库

[英]Importing repository in Azure DevOps with Git LFS

I am trying to migrate Bitbucket repositories to DevOps using the import repository function in DevOps.我正在尝试使用 DevOps 中的导入存储库 function 将 Bitbucket 存储库迁移到 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.其中一些存储库启用了 LFS,看起来 DevOps 没有导入 LFS 文件,因为当我克隆存储库时,我遇到了很多 LFS 错误。 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.我试图下载一个提交的 zip 文件,虽然它应该是大约 12GB 的所有文件,但它刚刚超过 600MB。

Does anyone know how to import repositories in DevOps with LFS enabled correctly?有谁知道如何在正确启用 LFS 的情况下在 DevOps 中导入存储库?

What if my source repository contains Git LFS objects?如果我的源存储库包含 Git LFS 对象怎么办? Git import will not import Git LFS objects. Git 导入不会导入 Git LFS 对象。

LFS objects can be moved using the following steps:可以使用以下步骤移动 LFS 对象:

Import the repository using import repository feature into Azure DevOps.使用导入存储库功能将存储库导入 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)这会将所有 Git 对象从源复制到 Azure DevOps(这也将导入 LFS 指针,它们是 Git 对象但不是 LFS 文件)要移动 LFS 文件(您将需要 Git.exe 和 LFS 客户端在相同的框并访问源存储库和目标存储库)

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') 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”将导入的存储库从 Azure DevOps 克隆到本地系统,克隆将工作,但在执行 LFS 文件签出时会失败将源存储库添加为远程(比如“源”)执行“git lfs fetch source –all”(这将带来从源到本地存储库的所有 LFS 文件)假设目标 VSTS 存储库是您的“目标”远程执行“git lfs push target –all”

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

发现这对我有帮助:将 Azure DevOPs 存储库迁移到 BitBucket: https ://amald-nav.medium.com/migrate-azure-devop-repository-to-bitbucket-dc4692935104

I run into the same issue, check the steps 2 and 4, basically the ones Microsoft's post didn't specified:我遇到了同样的问题,检查步骤 2 和 4,基本上是微软的帖子没有指定的那些:

  1. Clone the imported repository from Azure DevOps to local system, clone will work but it will fail while performing checkout of LFS files将导入的存储库从 Azure DevOps 克隆到本地系统,克隆将起作用,但在执行 LFS 文件检出时会失败

  2. Open git bash in your folder project or open cmd and go to that folder, then do:在文件夹项目中打开 git bash 或打开 cmd 和 Z34D1F91FB2E514B8576FAB1A75A 文件夹,然后执行:

    git remote add source https://github.com/git/git (replace that link with your repo's link) git 远程添加源https://github.com/git/git (将该链接替换为您的回购链接)

  3. Perform git lfs fetch source --all (this will bring over all LFS files from source to your local repository)执行 git lfs fetch source --all (这会将所有 LFS 文件从源代码带到您的本地存储库)

  4. Perform git remote add target AzureRepoLink执行git 远程添加目标AzureRepoLink

  5. Perform git lfs push target --all (this step will push all LFS files to new repo)执行git lfs push target --all (此步骤会将所有 LFS 文件推送到新仓库)

  6. Clone your new repo again in a new folder and everything should be there在一个新文件夹中再次克隆你的新仓库,一切都应该在那里

I'm sure step 4 can be done better, but it works this way.我确信第 4 步可以做得更好,但它是这样工作的。

I hope I helped我希望我有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM