利用coding.net制作CocoaPods国内镜像源
在上一篇文章中说了怎么解决无限卡在Setting up CocoaPods master repo,我就想有没有办法在本地或者国内搭建个来方便他们下载,还好大神们留下一些教程.下面我们来看怎么制作:
1.先升级git版本
git --version
git version 1.7.1
如果输出的是1.7.x,那么就要升级git到1.8.x去了,不然下面的基本上就不用看了.
下载更新git源:
wget -O /etc/yum.repos.d/PUIAS_6_computational.repo https://gitlab.com/gitlab-org/gitlab- recipes/raw/master/install/centos/PUIAS_6_computational.repo
如果上面的下载出错的话,那么只能自己手动加源内容了:
cat /etc/yum.repos.d/PUIAS_6_computational.repo
[PUIAS_6_computational] name=PUIAS computational Base $releasever - $basearch mirrorlist=http://puias.math.ias.edu/data/puias/computational/$releasever/$basearch/mirrorlist gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puias
然后下载key:
wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-puias http://springdale.math.ias.edu/data/puias/6/x86_64/os/RPM-GPG-KEY-puias && rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-puias
更新git:
yum install git -y
git --version
git version 1.8.3.1
2.下载CocoaPods的github代码:
cd /home/
git clone --mirror https://github.com/CocoaPods/Specs.git
然后修改config文件:
cat /home/Specs.git/config
[core] repositoryformatversion = 0 filemode = true bare = true [remote "origin"] fetch = +refs/heads/*:refs/heads/* fetch = +refs/tags/*:refs/tags/* mirror = true url = https://github.com/CocoaPods/Specs.git [remote "mirrors"] url = git@git.coding.net:rocdk/Specs.git mirror = true skipDefaultUpdate = true
增加个自动同步到coding的脚本:
vi /home/Specs.git/auto_sync.sh
#!/bin/bash cd /home/Specs.git/ git fetch remote git push mirrors
最后定时同步:
crontab -l
0 */2 * * * /bin/sh /home/Specs.git/auto_sync.sh > /var/log/specssync.log 2>&1
好了,现在我们就有了个自己的cocoapods国内镜像了.
ps:
如果不想自己去做镜像的话,那么就请用下面这几个cocoapods国内镜像吧:
https://coding.net/u/rocdk/p/Specs/git (这个是我的)
https://coding.net/u/ganl/p/Specs/git
评论: