拉取github的代码,上传到coding.net

在不FQ的情况下想到的是使用git fetch替代git clone,避免git clone失败后没有记录保存。

在git fetch完成后发现实际上可以先git remote add https://xxx.git 这样可以用快捷方式来操作。但是git fetch 在中断后也需要重新去fetch,采用下面的shell脚本去拖代码(还需要优化,如果成功后再去执行会重新fetch全部,还是慢慢等比较靠谱

git init
while [ 1 -ne 0 ]
do
git fetch https://github.com/mrdoob/three.js.git
sleep 600
done

这样可以在晚上的时候进行下载。
下载完成后,需要进行checkout。建议在上面一步添加别名

git remote add <自定义名字> https://github.com/mrdoob/three.js.git
git fetch <自定义名字> master

在经过很长时间后,下载完成后发现需要checkout。可以直接用上面的master,或者按照下面这种。

git checkout FETCH_HEAD
git branch <自定义branch名>

最后添加coding.net的地址,也添加成remote然后上传

git remote -v
codingThree	https://git.coding.net/xushengjin/threeJS_mirror.git (fetch)
codingThree	https://git.coding.net/xushengjin/threeJS_mirror.git (push)
gitThree	https://github.com/mrdoob/three.js.git (fetch)
gitThree	https://github.com/mrdoob/three.js.git (push)

 git push codingThree codingThreeJS

其中codingThree是远程仓库,codingThreeJS是本地的代码。

猜你喜欢

转载自blog.csdn.net/xsjyahoo/article/details/87870850