github CocoaPods速度太慢,不搭梯子的情况下,使用起来非常不爽。
网上搜索到的一个国内源:https://gitcafe.com/lloydsheng/Specs.git
点开后跳转到了https://coding.net/gitcafe.html 是 GitCafe 项目迁移至 Coding.net 公告
还是自己弄下吧,https://help.github.com/articles/duplicating-a-repository/
cd / && mkdir mirrors && cd mirrors git clone --mirror https://github.com/CocoaPods/Specs.git # Make a bare mirrored clone of the repository cd Specs.git/
在主机里 git clone 速度就是快
本来准备在阿里云上弄个镜像repo
在阿里云Code上新建项目:https://code.aliyun.com/ganl/Specs.git,
git remote set-url --push origin https://code.aliyun.com/ganl/Specs.git # Set the push location to your mirror
复制ssh密钥到阿里云Code:https://code.aliyun.com/profile/keys/new :
git config --global user.email "austgl@qq.com" ssh-keygen -t rsa -C "austgl@qq.com" cat ~/.ssh/id_rsa.pub
手工执行一次同步:
git push --mirror
每次都100%的时候报错
fatal: The remote end hung up unexpectedly
[root@iZu1q2b9vebZ Specs.git]# fatal: internal server error
http://stackoverflow.com/questions/6842687/the-remote-end-hung-up-unexpectedly-while-git-cloning
git config --global http.postBuffer 1048576000
按照再去提交还是无果,最后在页面上新建了一个readme,发现这个仓库的大小有1993M,gitlab也不知道怎么处理的,reversion都到哪里去了~
只好换coding.net试试
git remote set-url --push origin git@git.coding.net:ganl/Specs.git
[root@iZu1q2b9vebZ Specs.git]# cat config [core] repositoryformatversion = 0 filemode = true bare = true [remote "origin"] url = https://github.com/CocoaPods/Specs.git fetch = +refs/*:refs/* mirror = true pushurl = git@git.coding.net:ganl/Specs.git
再次 git push –mirror
结束时也报了很多error
remote: error: hook declined to update refs/pull/1377/head fatal: The remote end hung up unexpectedly fatal: The remote end hung up unexpectedly
打开https://git.coding.net/ganl/Specs.git,看到commit最后更新时间是4个小时前
再从github更新一次并同步到coding:
git fetch -p origin && git push –mirror
与github上对比,commit最新提交时间一致,应该没什么问题。
增加同步脚本:
vi sync.sh #!/bin/bash cd /mirrors/Specs.git/ git fetch -p origin git push --mirror
手动执行同步脚本:
chmod +x /mirrors/Specs.git/sync.sh
/mirrors/Specs.git/sync.sh
增加定时任务:
crontab -e 30 * * * * /mirrors/Specs.git/sync.sh > /var/log/specssync_`date +"\%Y\%m\%d"`.log 2>&1
CocoaPods换成自己的镜像源:
pod repo remove master pod repo add master https://git.coding.net/ganl/Specs.git pod repo update pod setup
使用时需要注意Podfile 首行需要加上 source ‘https://git.coding.net/ganl/Specs.git’
在pod install、 pod update的时候不想升级specs库 可以使用参数忽略掉
pod install --verbose --no-repo-update pod update --verbose --no-repo-update
未经允许不得转载:ganlei的个人博客 » coding.net制作CocoaPods国内镜像源