当前位置:   article > 正文

CocoaPods基础篇之创建私有 repo_pod add repo

pod add repo

1、创建一个空的 repository 

我是在github上创建的 : https://github.com/zhiguangqiao/cocoapod-repo.git

创建完之后什么都没有,如图


2、在终端添加这个 repo

执行pod repo add 命令添加 repo

  1. $pod repo add zhiguang-repo https://github.com/zhiguangqiao/cocoa
  2. pod-repo.git
  3. Cloning spec repo `zhiguang-repo` from `https://github.com/zhiguangqiao/cocoapod-repo.git`


执行 pod repo list 查看repo列表

  1. $pod repo list
  2. master
  3. - Type: git (master)
  4. - URL: https://github.com/CocoaPods/Specs.git
  5. - Path: /Users/qiaozhiguang/.cocoapods/repos/master
  6. xsl-mobile-cocoaspecs
  7. - Type: git (master)
  8. - URL: http://gitlab.xsl.com:10080/mobile/cocoaspecs.git
  9. - Path: /Users/qiaozhiguang/.cocoapods/repos/xsl-mobile-cocoaspecs
  10. zhiguang-repo
  11. - Type: git (unknown)
  12. - URL: https://github.com/zhiguangqiao/cocoapod-repo.git
  13. - Path: /Users/qiaozhiguang/.cocoapods/repos/zhiguang-repo
  14. 3 repos

可以看到已经添加成功,由于 新建的那个 repository 是空的,所有 这个  repo 下面 也是空的,什么都没有如下命令

  1. $cd ~/.cocoapods/repos/zhiguang-repo/
  2. $ls -a
  3. . .. .git



3、向新创见的 repo 中添加一个 podspec 文件 

为了演示,我使用以前创建好的现成的 git 项目 https://github.com/zhiguangqiao/QZCrashLogManager 

源码如图:




将 https://github.com/zhiguangqiao/QZCrashLogManager.git 克隆到本地


  1. $git clone https://github.com/zhiguangqiao/QZCrashLogManager.git
  2. Cloning into 'QZCrashLogManager'...
  3. remote: Counting objects: 349, done.
  4. remote: Total 349 (delta 0), reused 0 (delta 0), pack-reused 349
  5. Receiving objects: 100% (349/349), 141.84 KiB | 12.00 KiB/s, done.
  6. Resolving deltas: 100% (67/67), done.
  7. Checking connectivity... done.

$cd QZCrashLogManager/

  1. $ls -a
  2. . .git .travis.yml LICENSE QZCrashLogManager.podspec _Pods.xcodeproj
  3. .. .gitignore Example Pod README.md


执行pod repo push 命令将 podspec 文件push 到 新建的 repo 中

  1. $pod repo push zhiguang-repo QZCrashLogManager.podspec --allow-warnings
  2. Validating spec
  3. -> QZCrashLogManager (0.1.0)
  4. - WARN | description: The description is shorter than the summary.
  5. Updating the `zhiguang-repo' repo
  6. Your configuration specifies to merge with the ref 'master'
  7. from the remote, but no such ref was fetched.
  8. Adding the spec to the `zhiguang-repo' repo
  9. - [Add] QZCrashLogManager (0.1.0)
  10. Pushing the `zhiguang-repo' repo
  11. To https://github.com/zhiguangqiao/cocoapod-repo.git
  12. * [new branch] master -> master


4、到 github 页面去 查看 结果如图:


 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/529905
推荐阅读
  

闽ICP备14008679号