代码仓库迁移后的配置
仓库由之前的107迁移到75,主要受到的影响是CocoaPods私有库和公有镜像库。
修改本机pod库的HoriSpecs和master地址:
1、修改HoriSpecs库地址:
pod repo remove HoriSpecs
pod repo add HoriSpecs ssh://git@192.168.51.75/source/HoriSpecs.git
2、修改master地址,考虑到官方的库更新得太慢,所以我在内网制作了官方库的镜像,每天会更新一次:
pod repo remove master
git clone ssh://git@192.168.51.75/source/Specs.git ~/.cocoapods/repos/master
3、更新pods库
pod repo update
参与私有库的开发的注意
1、如果有参与私有库的开发,一定要修改私有库源码中的origin地址
git remote set-url origin 75服务器上对应的私有库地址.git
2、注意podSpecs文件中的s.source是否是75服务器上对应的库地址
# 这个地址必须为http,不能是ssh的
s.source = { :git => 'http://192.168.51.75/source/HoriSip.git', :tag => s.version.to_s }
最后一步
在使用CocoaPods的项目中,在Podfile文件的开头指定库的地址source
source 'ssh://git@192.168.51.75/source/Specs.git' #内网官方仓库镜像地址
source 'ssh://git@192.168.51.75/source/HoriSpecs.git' #自己的仓库地址
target 'SmartCommunity' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for SmartCommunity
pod 'HoriWebRTC'
pod 'MagicWindowSDK'
pod 'HoriLogger'
target 'SmartCommunityTests' do
inherit! :search_paths
# Pods for testing
end
end
git clone使用http地址的时返回403
这是因为Phabricator做过一次迁移,而git clone缓存了迁移前服务器的密码,所以导致返回403。解决方法:
打开~/.gitconfig,删除其中的[credential] helper;
如果~/.gitconfig文件中没有[credential] helper这栏,那么使用如下命令查看:
git config --show-origin --get credential.helper
该命令会打印哪个文件中有[credential] helper选项,打开文件然后删除该项。
1、在清空完密码后,我们不想每次git clone http://192.168.51.75/xxxx.git的时候都输入账号密码,那么在执行git clone之前先执行如下命令:
git config --global credential.helper store
// 再执行git clone,输入账号,密码。以后clone75服务器上的代码就需要再输入账号密码了
git clone http://192.168.51.75/xxxx.git
2、如果此时还是提示403,在cd ~/用户主目录下,查看ls -al是否有.git-credentials文件,如果有就打开这个文件,并删除这个文件里的所有内容,保存退出。