I get an error while create a private repo. This are the steps I take:
PrivateRepo
and set the valuescommands:
git add .
git commit -m “Initial Commit"
git remote add origin https://Username@bitbucket.org/Username/privaterepo.git
git push -u origin master
commands:
git tag 0.1.0
git push origin 0.1.0
commands:
pod repo add PrivateRepo https://Username@bitbucket.org/Username/privaterepo.git
pod repo push PrivateRepo PrivateRepo.podspec --swift-version=4.1
An unexpected version directory
Classes
was encountered for the/Users/Username/.cocoapods/repos/PrivateRepo/PrivateRepo
Pod in thePrivateRepo
repository.
This is my podfile in my other project:
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
This is my podspec file:
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
It looks like you're almost there, but just haven't set up your podspec repo (which is a recommended step: https://guides.cocoapods.org/making/private-cocoapods.html).
In your Podfile, try replacing the source URL of your repo to that of your spec instead. Eg:
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
I also found this article helpful in setting up a private repo: https://medium.com/practical-code-labs/how-to-create-private-cocoapods-in-swift-3cc199976a18
EDIT
In our project, we now URL directly to the git source in the pod file, as it allows us to quickly change branches in the pod and means you can remove the 2 source
lines I mentioned above. Either way works though :).
Here is an example of using a URL straight to the git project in your pod file:
pod ‘PrivatePod’, :git => "git@github.com:Test/privatepod.git"