美文网首页
git创建本地仓库和远程仓库

git创建本地仓库和远程仓库

作者: 1234yws | 来源:发表于2019-01-23 21:11 被阅读12次

一、本地仓库

1、制作本地仓库

  cd到需要制作仓库的文件夹
  pod lib create 仓库名字
  //例如
  pod lib create UtilsLib
制作本地仓库.jpg

创建完成后会自动打开Xcode

替换文件


替换文件@2x.png 替换文件2@2x.png

2、在主项目中pod导入本地仓库,找到刚才制作仓库的路径

pod 'UtilsLib', :path => '../../UtilsLib/UtilsLib'

//
../ 表示返回上层目录

3、执行 pod install

4、打开主项目,导入,编译

二、远程仓库

指定索引仓库

查看当前索引仓库
pod repo

添加索引仓库
pod repo add 仓库名 仓库SSH(HTTPS)地址 来添加一个远程索引仓库
pod repo add ProjectModel https://gitee.com/1234yws/ProjectModel.git

1、将本地仓库上传到自己的私有仓库(网上有很多)我用的是码云

//提交到本地缓存区
git add .
//提交
git commit -m '初始化'


//连接远程库
git remote add origin https://gitee.com/XXX/PrivateProject.git

//强制提交
git push origin master -f

2、校验本地仓库和远程校验

 pod lib lint --allow-warnings

 pod spec lint --allow-warnings

错误处理


错误@2x.png
解决@2x.png

3、设置.podspec文件


podspec文件设置@2x.png

4、打tag标记

git tag 0.1.0

git push --tags

5、将podspec文件提交到远程仓库

pod repo

ProjectModel 私有仓库地址

master

6、上传至远程私有库

cd本地库文件路径,提交.podspec

pod repo push ProjectModel PrivateProject.podspec

三、远程库版本更新

1、本地库修改,然后提交到远程库

//提交到本地缓存区
git add .

//提交
git commit -m '初始化'

//连接远程库  git remote add origin 远程仓库地址
git remote add origin https://gitee.com/1234yws/PrivateProject.git

//强制提交
git push origin master -f

2、校验本地仓库和远程校验

 pod lib lint --allow-warnings

 pod spec lint --allow-warnings

4、打tag标记

git tag 0.1.1

git push --tags

5、上传至远程私有库

cd本地库文件路径,提交.podspec

pod repo push ProjectModel PrivateProject.podspec

6、去工程中执行pod install

附录

podfile文件内容

#远程私有库
source 'https://gitee.com/1234yws/ProjectModel.git'
#Cocoapod远程公有库
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target'textGit'do

  pod 'AFNetworking'

  pod 'PrivateProject','~>0.1.2'
end

相关文章

  • Git基本操作和错误

    创建SSH Key 本地创建仓库操作 创建本地仓库 将文件添加进Git 提交 Git远程仓库操作 查看远程仓库 添...

  • git 命令行操作笔记

    git中的选项解释 创建本地git仓库 提交代码到git仓库 本地git仓库添加到远程仓库中 克隆远程仓库到本地 ...

  • git 远程仓库配置

    git 仓库的配置分为本地和远程两个部分,现在分别对远程和本地进行描述. 远程 创建远程git 仓库mkdir ...

  • Git使用小结

    廖雪峰的Git教程 一、Git仓库 仓库分为本地仓库和远程仓库,它们通过秘钥和远程仓库地址来建立连接。 A. 创建...

  • 克隆远程仓库

    克隆远程仓库到本地,先创建远程仓库,再使用git clone + <远程仓库地址> 命令实现将远程仓库克隆到本地。...

  • git 使用手册

    1、创建仓库 本地目录创建仓库:git init远程仓库克隆:git clone注:默认克隆远程仓库的master...

  • Git版本控制的使用

    本地创建Git仓库 本地Git仓库版本管理 GitLab远程创建提交本地仓库 需要先到GitLab添加自己的key...

  • VS Code中进行git远程仓库同步

    本地仓库和远程仓库建立连接 方式一:从Git远程仓库克隆:命令 git clone "SSH方式二:在本地创建一个...

  • git初识(常用git命令集合)

    一、本地创建git项目推送到远程仓库 1.查看本地库的远程仓库地址 git remote -v 2. 远程仓库地...

  • git初识(常用git命令汇总)

    一、本地创建git项目推送到远程仓库 1.查看本地库的远程仓库地址 git remote -v 2. 远程仓库地...

网友评论

      本文标题:git创建本地仓库和远程仓库

      本文链接:https://www.haomeiwen.com/subject/dgigrqtx.html