程序员

如何上传组件到github最简单使用以及解决办法

2019-10-08  本文已影响0人  小橙子爱吃糖

仅在此记录一下

https://cocoapods.org/

前言:

在github上创建一个索引地址:如:https://github.com/chenyu9212/CYSpec.git

一个存放工程项目地址 如:https://github.com/chenyu9212/CYDEMOSpec.git

具体步骤如下:

1.GitHub上创建仓库

2.仓库clone地址记录一下:如:https://github.com/chenyu9212/CYDEMOSpec.git

3.创建模版

  pod lib create CYDEMOSpec

        替换ReplaceMe,自己可以创建一个类放里面,然后在Example文件夹下执行pod update

===========注意:以下指令都是在和CYDEMOSpec.podspec同级目录下执行的=============

4.修改CYDEMOSpec.podspec文件中git地址为clone的仓库地址

 s.source           = { :git => 'https://github.com/chenyu9212/CYDEMOSpec.git', :tag =>s.version.to_s}

5.本地库添加到远程库

  git remote add origin https://github.com/chenyu9212/CYDEMOSpec.git

6.上传代码库

git add .

git commit -m '0.1.0'

git pull origin master --allow-unrelated-histories

此时ReadMe.文件会有冲突,打开README.md文件

然后删除

<<<<<<< HEAD

删除最下面的部分如:

=======

# CYDEMOSpec

>>>>>>> 1d46cadd585df1d5b62d423c41765f3e62adf956

接着

git add .

git commit -m '0.1.0'

git push origin master

git tag '0.1.0'

git push --tags

7.注册标示 邮箱填你自己的邮箱 后面开发者人名 接着描述随便填写

pod trunk register2043217414@qq.com‘chenyu9212’--description='chenyu9212 mac'

然后进入你的邮箱看有没有搜到邮件,点击确认连接,或者复制到浏览器里打开链接。(有点慢)

接着在终端输入:pod trunk me (很慢)

8.执行  pod trunk push MYItemOne.podspec(执的行慢)

如果如下说明成功了

 🎉  Congrats

 🚀  CYDEMOSpec (0.1.0) successfully published

 📅  September 24th, 00:41

 🌎 https://cocoapods.org/pods/CYDEMOSpec

 👍  Tell your friends!

9.添加私有库索引(github上的私有库的索引不能和github上工程文件的一样)

pod repo #查看本地索引库

pod repo add索引库名称索引库地址#添加本地索引库

pod repo remove索引库名称#删除本地索引库

pod repo addCYDEMOSpec https://github.com/chenyu9212/CYSpec.git

10.使用私有库

platform :ios,'8.0'

source 'https://github.com/CocoaPods/Specs.git'

source 'https://github.com/chenyu9212/CYSpec.git’(索引地址)

target 'CardFuelling’do

pod 'CYDEMOSpec'

end

问题总结:

索引链接地址里面包含工程,解决办法替换索引库地址 删除多余的缓存,进入  /用户/user/资源库/Caches/CocoaPods里面删除 search_index.json这个文件,然后再次pod search,如果还是搜索不到,进入文件 /用户/user/.cocoapods/repos/ 删除多余项目文件,再次pod search
上一篇 下一篇

猜你喜欢

热点阅读