{"id":2800,"date":"2024-11-08T10:22:14","date_gmt":"2024-11-08T16:22:14","guid":{"rendered":"https:\/\/lab.rapternet.us\/?p=2800"},"modified":"2024-09-27T21:09:17","modified_gmt":"2024-09-28T02:09:17","slug":"backing-up-git-repositories","status":"publish","type":"post","link":"https:\/\/lab.rapternet.us\/?p=2800","title":{"rendered":"Backing up Git Repositories"},"content":{"rendered":"\n<p>We all rely quite a bit on cloud services that are hosted by faceless corporations, these are generally stable services, but if Google&#8217;s actions over the years have shown anything, it&#8217;s that these services can disappear overnight without warning. So I try to do cloud backups from time to time for the various services I rely on.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>I setup a Gitea server a while ago and never really started using it. Since I read about a few ways to mirror cloud based repositories, I decided to try it out on my Gitea server to get some extra usage out of it. The process is pretty simple to do (especially for my nominal use case of public repositories).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Github<\/h2>\n\n\n\n<p>I&#8217;m Gitea, we start out with the + icon to add our new repository mirrors:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"248\" height=\"175\" src=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2023\/02\/image-27.png\" alt=\"\" class=\"wp-image-2801\"\/><figcaption class=\"wp-element-caption\">New Migration<\/figcaption><\/figure>\n<\/div>\n\n\n<p>Pick your source, we&#8217;ll be looking at GitHub.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"897\" src=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2023\/02\/image-29-1024x897.png\" alt=\"\" class=\"wp-image-2821\" srcset=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2023\/02\/image-29-1024x897.png 1024w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2023\/02\/image-29-300x263.png 300w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2023\/02\/image-29-768x673.png 768w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2023\/02\/image-29.png 1072w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>Pick the options for the repo that you&#8217;re mirroring. Add the link to GitHub and any other options you want to select, I included the wiki in all my mirrors and make sure the check box for the repo being a mirror is checked as well.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"814\" height=\"508\" src=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2023\/02\/image-28.png\" alt=\"\" class=\"wp-image-2802\" srcset=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2023\/02\/image-28.png 814w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2023\/02\/image-28-300x187.png 300w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2023\/02\/image-28-768x479.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><figcaption class=\"wp-element-caption\">This repo is a mirror and mirror the github wiki if it exists<\/figcaption><\/figure>\n\n\n\n<p>For public repos, you don&#8217;t need any sort of authentication, but for private repositories, you will need to set it up.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">BitBucket<\/h2>\n\n\n\n<p>For BitBucket, we want to start out by creating an app password for your account. This will be used by Gitea to clone your repositories. The app password just needs read access as well, no need for write access.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"1005\" src=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2023\/02\/image-30-1024x1005.png\" alt=\"\" class=\"wp-image-2824\" srcset=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2023\/02\/image-30-1024x1005.png 1024w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2023\/02\/image-30-300x294.png 300w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2023\/02\/image-30-768x754.png 768w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2023\/02\/image-30.png 1416w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><figcaption class=\"wp-element-caption\">BitBucket App Password<\/figcaption><\/figure>\n\n\n\n<p>Next up, use the clone link, give your BitBucket username (not email) and the app password to Gitea and it&#8217;ll work.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>This worked out pretty well. I now have backups of my public GIT repos along with repos that I rely on. It&#8217;s also pretty much set it and forget it so that you don&#8217;t have to worry about those backups. Though as always, do check\/test your backups regularly.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We all rely quite a bit on cloud services that are hosted by faceless corporations, these are generally stable services, but if Google&#8217;s actions over the years have shown anything, it&#8217;s that these services can disappear overnight without warning. So I try to do cloud backups from time to time for the various services I &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/lab.rapternet.us\/?p=2800\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Backing up Git Repositories&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[96,94,93],"class_list":["post-2800","post","type-post","status-publish","format-standard","hentry","category-how-to","tag-backups","tag-git","tag-tools"],"_links":{"self":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts\/2800","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2800"}],"version-history":[{"count":14,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts\/2800\/revisions"}],"predecessor-version":[{"id":4110,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts\/2800\/revisions\/4110"}],"wp:attachment":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2800"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2800"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2800"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}