Build GitHub Mirror Site on BtPanel

0, cause

For some well-known reasons, domestic access to foreign websites is somewhat difficult. After something happened, GitHub access had random connection resets. As for the sub-servers in mainland China to access GitHub, it is even more difficult.
For me, who has a server in Hong Kong, China, how can I endure not being able to copy projects from GitHub to my local? Therefore, I set up a GitHub mirror station.

1, reverse proxy

Create a new website on an overseas server:

github.mirror.com
rawgithub.mirror.com
objectsgithub.mirror.com
codeloadgithub.mirror.com

Corresponding to:

github.com
raw.githubusercontent.com
objects.githubusercontent.com
codeload.tsinbei.com

It can be used when Git Clone the entire project, download a single file, download release, and download master.zip.
Note: After configuring reverse proxy and SSL, remember to bind the origin site domain name!

2. Configure Git Clone global replacement

Use script:

Comment first then view it after your comment is approved. Join QQ Group to display all hidden texts.

Implement Git Clone global replacement with mirror site address.

3, configure hosts

exist

/etc/hosts
Add to:
conf
1
2
3
4
x.x.x.x github.com
x.x.x.x raw.githubusercontent.com
x.x.x.x objects.githubusercontent.com
x.x.x.x codeloadgithub.tsinbei.com

Where x.x.x.x is the server public IP of the mirror station

4. Ignore SSL certificate errors

exist

/root/.bashrc
add:
conf
1
alias wget='wget - -no-check-certificate'

and execute the command

Bash
1
source ~/.bashrc

to make it effective.

5. Test

can use

Bash
1
git clone https://github.com/…
Bash
1
wget https://raw.githubusercontent.com/…

Wait for the command to test the effect.

Build GitHub Mirror Site on BtPanel

https://blog.tsinbei.com/en/archives/152/

Author
Hsukqi Lee
Posted on

2022-02-05

Edited on

2022-07-28

Licensed under

CC BY-NC-ND 4.0

Comments

Name
Mail
Site
None yet