{"id":8040,"date":"2021-06-30T16:43:35","date_gmt":"2021-06-30T21:43:35","guid":{"rendered":"https:\/\/www.rushworth.us\/lisa\/?p=8040"},"modified":"2021-06-30T16:47:19","modified_gmt":"2021-06-30T21:47:19","slug":"ado-migrating-a-repository-to-azure-repos-and-keeping-your-commit-history","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=8040","title":{"rendered":"ADO &#8211; Migrating a Repository to Azure Repos (and keeping your commit history)"},"content":{"rendered":"<p>The most direct way to migrate a repo into Azure Repos is to create a new, blank repository. This may mean making a new project. From the organization\u2019s main page, click \u201cNew project\u201d<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1913\" height=\"414\" class=\"wp-image-8041\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-6.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-6.png 1913w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-6-300x65.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-6-1024x222.png 1024w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-6-768x166.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-6-1536x332.png 1536w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-6-750x162.png 750w\" sizes=\"auto, (max-width: 1913px) 100vw, 1913px\" \/><\/p>\n<p>Or it may mean making a new repo in an existing project. From an existing repo, click the drown-down next to the repo name and select \u201cNew repository\u201d<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1177\" height=\"410\" class=\"wp-image-8042\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-7.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-7.png 1177w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-7-300x105.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-7-1024x357.png 1024w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-7-768x268.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-7-750x261.png 750w\" sizes=\"auto, (max-width: 1177px) 100vw, 1177px\" \/><\/p>\n<p>Name the repository but <em>don\u2019t<\/em> add a README. We want a blank repo<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"474\" height=\"318\" class=\"wp-image-8043\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-8.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-8.png 474w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-8-300x201.png 300w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/p>\n<p>Note the URL to the repository \u2013 in this case, it\u2019s <a href=\"https:\/\/ado0255@dev.azure.com\/ado0255\/History%20Test\/_git\/Another%20History%20Test\">https:\/\/ado0255@dev.azure.com\/ado0255\/History%20Test\/_git\/Another%20History%20Test<\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1394\" height=\"499\" class=\"wp-image-8044\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-9.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-9.png 1394w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-9-300x107.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-9-1024x367.png 1024w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-9-768x275.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-9-750x268.png 750w\" sizes=\"auto, (max-width: 1394px) 100vw, 1394px\" \/><\/p>\n<p>Find the URL for your existing Git repo \u2013 if you cd into the project\u2019s folder and run \u201cgit remote -v\u201d, you will get a list of the repos. Make a new folder somewhere \u2013 this is a temporary staging area to move the data from your existing repo over to the new Azure Repo. Change directories into your new folder. Run <em>git clone \u2013mirror <\/em><strong><em>URLToOldRepo<\/em> <\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"979\" height=\"512\" class=\"wp-image-8045\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-10.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-10.png 979w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-10-300x157.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-10-768x402.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-10-750x392.png 750w\" sizes=\"auto, (max-width: 979px) 100vw, 979px\" \/><\/p>\n<p>You will see data being downloaded from your git server.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"979\" height=\"512\" class=\"wp-image-8046\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-11.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-11.png 979w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-11-300x157.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-11-768x402.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-11-750x392.png 750w\" sizes=\"auto, (max-width: 979px) 100vw, 979px\" \/><\/p>\n<p>Change directories into the folder that just got downloaded. You won\u2019t see your code like you normally do when you clone a git repo. You\u2019re looking at the underlying git <em>stuff<\/em> that makes up the repo. You\u2019re code is all in there, as are all of the branches and commit history.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"979\" height=\"512\" class=\"wp-image-8047\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-12.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-12.png 979w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-12-300x157.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-12-768x402.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-12-750x392.png 750w\" sizes=\"auto, (max-width: 979px) 100vw, 979px\" \/><\/p>\n<p>Now add the new Azure Repo as a remote \u2013 in this case, I\u2019m naming the remote \u201cado\u201d. Then run \u201cgit push ado \u2013all\u201d to push everything up to the new Azure Repo.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"976\" height=\"117\" class=\"wp-image-8048\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-13.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-13.png 976w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-13-300x36.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-13-768x92.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-13-750x90.png 750w\" sizes=\"auto, (max-width: 976px) 100vw, 976px\" \/><\/p>\n<p>Stuff will transfer \u2013 you may be prompted to log into your ADO repository first. Eventually, you\u2019ll see new branches being created on the remote and the process will complete.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"718\" height=\"486\" class=\"wp-image-8049\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-14.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-14.png 718w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-14-300x203.png 300w\" sizes=\"auto, (max-width: 718px) 100vw, 718px\" \/><\/p>\n<p>Refreshing the Azure Repo, you\u2019ll now see the files.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1871\" height=\"618\" class=\"wp-image-8050\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-15.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-15.png 1871w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-15-300x99.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-15-1024x338.png 1024w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-15-768x254.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-15-1536x507.png 1536w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-15-750x248.png 750w\" sizes=\"auto, (max-width: 1871px) 100vw, 1871px\" \/><\/p>\n<p>Selecting \u201cCommits\u201d will display the commit history.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"982\" height=\"907\" class=\"wp-image-8051\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-16.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-16.png 982w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-16-300x277.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-16-768x709.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/06\/word-image-16-750x693.png 750w\" sizes=\"auto, (max-width: 982px) 100vw, 982px\" \/><\/p>\n<p>Anyone else using the repo will need to add the new remote. Use &#8220;git remote rm origin&#8221; to remove the existing origin, then use &#8220;git remote add origin <em>url<\/em>&#8221; to add the new Azure Repo as origin.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The most direct way to migrate a repo into Azure Repos is to create a new, blank repository. This may mean making a new project. From the organization\u2019s main page, click \u201cNew project\u201d Or it may mean making a new repo in an existing project. From an existing repo, click the drown-down next to the &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33],"tags":[1091,1092],"class_list":["post-8040","post","type-post","status-publish","format-standard","hentry","category-coding","tag-ado","tag-azure-devops"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/8040","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8040"}],"version-history":[{"count":3,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/8040\/revisions"}],"predecessor-version":[{"id":8054,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/8040\/revisions\/8054"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8040"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8040"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8040"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}