-
Notifications
You must be signed in to change notification settings - Fork 0
Home
为防止本人遇到突发情况,敬请好心人建一个镜像站进行推广,如下为镜像站搭建教程:
1、注册一个github.com账号,并登录;
2、打开 https://github.com/hjm2007/ppymirror
3、点右上角的Fork链接,fork完成后就得到了一个你自己的镜像网址。
但是fork的镜像不会自动跟随源项目而更新,怎么办呢?有2种办法:
方法1、每天手工更新,具体方法是删掉fork的项目,重新fork一下,就是最新的了。
具体是在Fork后的项目页面的顶部偏右的位置,有个Setting链接,点击Setting链接后,滚动到页面底部,点“Delete this repository”按钮,删除后重新Fork即可。
方法2、定时自动同步
你需要一台 墙外(因为安全的原因,必须墙外) 的Windows电脑或者Linux VPS,以Linux(Debian 10) VPS为例,首先,用ssh客户端登录linux,然后执行下列命令安装git工具:
apt update
apt install git
如果是windows电脑,请安装 Git for Windows
然后,使用 SSH 连接到你的 GitHub账号(利用 SSH 密钥可以连接 GitHub,而无需在每次访问时提供用户名或密码,方便定时更新git翻墙教程镜像) 参考: https://docs.github.com/cn/github/authenticating-to-github/connecting-to-github-with-ssh
然后 Linux 则依次执行下列命令(一行一行依次拷贝执行,注意将your-github-username换作你自己的github用户名):
cd /root
git config --global core.autocrlf input
git clone [email protected]:your-github-username/ppymirror.git
cd bnews
chmod +x syncnews.sh
git remote add upstream https://github.com/hjm2007/ppymirror
然后将脚本 /root/bnews/syncnews.sh 加到你的linux crontab 里面定时执行即可。
Windows 则先打开Git CMD命令行,依次执行下列命令:
git config --global core.autocrlf true
git clone [email protected]:your-github-username/ppymirror.git
cd bnews
git remote add upstream https://github.com/hjm2007/ppymirror
这时,在当前这个 bnews 目录下会有一个 syncnews.bat 命令脚本,把这个命令脚本加入到windows的任务计划程序定时执行即可。