在github/gitlab上下载单个文件

参考自:这里

mkdir mycode
cd mycode
git init
git remote add -f origin xxx.git #xxx是要下载的仓库
git config core.sparsecheckout true。# 将sparsecheckout设为true
echo 仓库名/子文件夹/要下载的文件名(不带后缀) >> .git/info/sparse-checkout
git pull origin master # 拉取文件
Logo

更多推荐