使用gitcache本地缓存github代码

安装gitcache

参考官方文档编译并安装
gitcache/README_cn.md at master · git-cloner/gitcache (github.com)
https://github.com/git-cloner/gitcache/blob/master/README_cn.md

配置开机启动

cat > /usr/lib/systemd/system/gitcache.service << EOF
[Unit]
Description=gitcache
Documentation=https://github.com/git-cloner/gitcache/blob/master/README_cn.md
After=syslog.target
After=network.target
RequiresMountsFor=/mnt/gitcache #等待挂载之后再启动服务
[Service]
Type=simple
ExecStart=/usr/local/bin/gitcache -ssh 1 -b /mnt/gitcache
ExecReload=/bin/kill -s HUP
ExecStop=/bin/kill -s QUIT
StandardOutput=append:/var/log/gitcache.log
StandardError=append:/var/log/gitcache_error.log
[Install]
WantedBy=multi-user.target
EOF

chown -R root:root /mnt/gitcache/
systemctl daemon-reload
systemctl start gitcache

测试

git config --global url."http://127.0.0.1:5000/".insteadOf https://
git clone https://github.com/huggingface/transformers-bloom-inference

取消缓存

git config --global --unset url."http://127.0.0.1:5000/".insteadOf https://
git config --global -l

你可能感兴趣的:(缓存,github)