git – 遇到了意外的版本目录

创建私人仓库时出错.这是我采取的步骤:

>创建文件夹,运行pod lint create PrivateRepo并设置值
>在BitBucket中创建私人仓库
>在PrivateRepo文件夹中运行此命令:

命令:

git add .
git commit -m “Initial Commit"
git remote add origin https://Username@bitbucket.org/Username/privaterepo.git
git push -u origin master

>更改podspec中的摘要和主页,并将上面的bitbucket链接设置为源
>运行此命令:

命令:

git tag 0.1.0
git push origin 0.1.0

>运行pod spec lint –swift-version = 4.1现在通过验证
>运行此命令:

命令:

pod repo add PrivateRepo https://Username@bitbucket.org/Username/privaterepo.git
pod repo push PrivateRepo PrivateRepo.podspec --swift-version=4.1

>到目前为止,没有出现任何错误.但是当我想将pod安装到我的其他项目时,我收到一个错误:

An unexpected version directory Classes was encountered for the
/Users/Username/.cocoapods/repos/PrivateRepo/PrivateRepo Pod in
the PrivateRepo repository.

这是我在其他项目中的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

这是我的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

最佳答案 看起来你几乎就在那里,但还没有设置你的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

我还发现这篇文章有助于设置私人仓库:
https://medium.com/practical-code-labs/how-to-create-private-cocoapods-in-swift-3cc199976a18

点赞