Github warehouse batch backup solution

Original link: https://www.blueskyxn.com/202208/6380.html

Github 仓库批量备份的解决方案

foreword

Recently, I saw that Github is arbitrarily banning accounts. Obviously, this goes against the spirit of open source first, and the contributions of those who have been banned are directly blocked and returned to zero.

And many users do not have the habit of backing up at all, which is obviously a risk.

So this article introduces some methods for batch backup of Github repositories.

It is worth mentioning that in July 2021, I contacted GitHub customer service, and I claimed to have unblocked my Action. Recently, I found that Github was fucking farting, and it didn’t unblock it at all. You are really numb and disgusting .

Reference article https://www.blueskyxn.com/202107/4731.html

Experimental repository https://github.com/BlueSkyXN/TencentCloud-Order/actions

same-stage dump method

Github peer platforms such as Gitlab and Gitee provide fast import methods, and also support dumping of private warehouses.

However, after Gitlab imports a certain amount of warehouses in batches, it will fail to import, which is not suitable for users with a particularly large amount.

script backup method

I refer to https://github.com/estrm/onemove/tree/master/github_repository_backup

Modify a version for personal use, you can use it to change the backup according to the idea https://github.com/BlueSkyXN/Github-Backup

QQ%E5%9B%BE%E7%89%8720220809115233.png

It should be noted that when backing up the Org organization, since the source code formats of the warehouse pages of different pages (users and organizations) are different, the same script needs a lot of carriage returns when running, but it can still be backed up in the end.

QQ%E5%9B%BE%E7%89%8720220809123243.png

QQ%E5%9B%BE%E7%89%8720220809125121.png

If you will not modify and use this script, then it is recommended to use other methods.

In addition, this method does not support private repositories

You need to manually pick private repositories and back them up by other methods

QQ%E5%9B%BE%E7%89%8720220809125203.png

GIT manual backup method

You can refer to this article https://itsmycode.com/support-for-password-authentication-was-removed-github/

First, you need to obtain the login key. Currently, password login is not supported.

At the URL shown in the figure, find PCT, which is Person Access Tokens, personal access token

QQ%E5%9B%BE%E7%89%8720220809125855.png

Then, create a new token, at any time, and then choose the permissions yourself. If you don’t want to choose, just fill it up. Remember to save it.

QQ%E5%9B%BE%E7%89%8720220809125928.png

QQ%E5%9B%BE%E7%89%8720220809130046.png

Then there is the SSH page, you need to configure a username and email address first

 git config --global user.name "your_github_username" git config --global user.email "your_github_email" git config -l

When you need to log in, you will be asked for your username and token

 git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY

Then Username is the username, and Password uses the Token just now

Then you must run this to cache if it is successful, and it will not work if it is unsuccessful.

 git config --global credential.helper cache

At the same time, he also provides a direct method

 git remote set-url origin https://@github.com//.git

Then

 git clone https://:@github.com//.git

Of course, for public warehouses, you don’t need to log in, just back up directly

Desktop manual backup method

Using the GitHub Desktop application, copy the repository directly to your local. Note that there cannot be anything in the directory.

direct backup method

Go directly to the warehouse page, the green code button -local-downloadzip can download the zip archive

This article is reprinted from: https://www.blueskyxn.com/202208/6380.html
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment