J. *_*Doe 5 git bitbucket cocoapods
创建私人存储库时出现错误。这是我采取的步骤:
PrivateRepo并设置值命令:
git add .
git commit -m “Initial Commit"
git remote add origin https://Username@bitbucket.org/Username/privaterepo.git
git push -u origin master
Run Code Online (Sandbox Code Playgroud)
命令:
git tag 0.1.0
git push origin 0.1.0
Run Code Online (Sandbox Code Playgroud)
命令:
pod repo add PrivateRepo https://Username@bitbucket.org/Username/privaterepo.git
pod repo push PrivateRepo PrivateRepo.podspec --swift-version=4.1
Run Code Online (Sandbox Code Playgroud)
存储库中
Classes的/Users/Username/.cocoapods/repos/PrivateRepo/PrivateRepoPod 遇到 意外的版本目录PrivateRepo。
这是我其他项目中的podfile:
source 'https://Username@bitbucket.org/Username/privaterepo.git'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, ’10.3’
target 'OtherProject' do
use_frameworks!
pod 'PrivateRepo'
end
Run Code Online (Sandbox Code Playgroud)
这是我的podspec文件:
Pod::Spec.new do |s|
s.name = 'PrivateRepo'
s.version = '0.1.0'
s.summary = 'test'
s.description = <<-DESC
TODO: Add long description of the pod here.
DESC
s.homepage = 'https://google.com'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'Username' => 'Username@hotmail.com' }
s.source = { :git => 'https://Username@bitbucket.org/Username/privaterepo.git', :tag => s.version.to_s }
s.ios.deployment_target = '8.0'
s.source_files = 'PrivateRepo/Classes/**/*'
end
Run Code Online (Sandbox Code Playgroud)
JWh*_*tey 11
看起来您已经快完成了,只是还没有设置您的 podspec 存储库(这是推荐的步骤:https ://guides.cocoapods.org/making/private-cocoapods.html )。
在您的 Podfile 中,尝试将存储库的源 URL 替换为规范的源 URL。例如:
source 'https://username@bitbucket.org/username/private-repo-specs.git'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, ’10.3’
target 'OtherProject' do
use_frameworks!
pod 'PrivateRepo'
end
Run Code Online (Sandbox Code Playgroud)
我还发现这篇文章有助于设置私人仓库:https : //medium.com/practical-code-labs/how-to-create-private-cocoapods-in-swift-3cc199976a18
编辑
在我们的项目中,我们现在直接将 URL 指向 pod 文件中的 git 源,因为它允许我们快速更改 pod 中的分支,这意味着您可以删除source我上面提到的 2行。无论哪种方式都有效:)。
这是在 pod 文件中直接使用 git 项目的 URL 的示例:
pod ‘PrivatePod’, :git => "git@github.com:Test/privatepod.git"