Cocoapods: Unable to lint lib or push pod with private repository

Created on 17 Sep 2016  ·  31Comments  ·  Source: CocoaPods/CocoaPods

I developing private pods with private repo. Before push I use next command to validate pod
pod lib lint --verbose [email protected]:*/*-ios.git,master --use-libraries --allow-warnings
Everything was great, but now I getting next error

Cloning spec repo `bitbucket-*-ios-1` from `git@bitbucket.*/*-ios.git`
  $ /Applications/Xcode.app/Contents/Developer/usr/bin/git clone git@bitbucket.*/*-ios.git bitbucket-*-ios-1
  Cloning into 'bitbucket-*-ios-1'...
 -> PrivatePhotoLibrary (1.4.10)
    - WARN  | source: Git SSH URLs will NOT work for people behind firewalls configured to only allow HTTP, therefore HTTPS is preferred.
    - ERROR | [iOS] unknown: Encountered an unknown error (Unable to create a source with URL [email protected]:*/*-ios.git
/Users/romantruba/.rvm/gems/ruby-2.3.0@railstutorial_rails_4_0/gems/cocoapods-1.0.1/lib/cocoapods/sources_manager.rb:42:in `find_or_create_source_with_url'
...

After the error, I have a directory "bitbucket-*-ios-1" with private repo content.

Also I'm unable to push into this private repo using pod push because of same error.

Checked on two pods.

What did you do?

pod lib lint --verbose [email protected]:*/*-ios.git,master --use-libraries --allow-warnings

What did you expect to happen?

Lint notifies me about success or code issue.

What happened instead?

Getting unknown error without any clues what I suppose to do
ERROR | [iOS] unknown: Encountered an unknown error (Unable to create a source with URL [email protected]:*/*-ios.git ...

CocoaPods Environment

Stack

   CocoaPods : 1.0.1
        Ruby : ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
    RubyGems : 2.6.4
        Host : Mac OS X 10.11.6 (15G1004)
       Xcode : 8.0 (8A218a)
         Git : git version 2.9.3
Ruby lib dir : /Users/romantruba/.rvm/rubies/ruby-2.3.0/lib
Repositories : bitbucket-*-ios - [email protected]:*/*-ios.git @ 1c511543e32449a9d951fbae87b317ca6fb0d96e
               brion - https://github.com/brion/OGVKit-Specs.git @ 91d779a78c12ae11dc7e601d3124ef848e056f0a
               master - https://github.com/CocoaPods/Specs.git @ a428e56d249fa4f6fae113ef4e7007f17135d39a
               * - [email protected]:*/*-ios.git @ 3ea4a4a7b39757fed0f659d18832be04ae4c4800

Installation Source

Executable Path: /Users/romantruba/.rvm/gems/ruby-2.3.0@railstutorial_rails_4_0/bin/pod

Plugins

cocoapods-deintegrate : 1.0.0
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.0.0
cocoapods-try         : 1.1.0

Podfile

platform :ios, '8.0'
use_frameworks!

source '[email protected]:*/*-ios.git'
source 'https://github.com/CocoaPods/Specs.git'

target 'PhotoLibraryTestApplication' do
    pod 'OCMock', '~> 3.3'
    pod 'TwitterLoggingService/ObjC', '~> 2.3'
    pod 'ObjectiveSugar'
    pod 'pop', '~> 1.0'
    pod 'GPUImagePrivate', '~> 0.1'
    pod 'PrivateUIKit', '~> 1.0'
    pod 'RSFoundationUtils', '~> 0.3'
end

Thanks.

Most helpful comment

We run into the same problem today. I think the problem is around def add_file(namespace, relative_header_path, final_name) in headers_store.rb.
@Dreddik I tried to fix it in my fork, it works for me now. Could you give my branch fix/lint-libraries at https://github.com/b-ray/CocoaPods.git a try? :)

All 31 comments

When I simply run pod spec lint PrivateUIKit.podspec --verbose or pod lib lint error is next:

Setting up CocoaPods master repo
  $ /Applications/Xcode.app/Contents/Developer/usr/bin/git remote set-url origin https://github.com/CocoaPods/Specs.git
  $ /Applications/Xcode.app/Contents/Developer/usr/bin/git checkout master
  Already on 'master'
  Your branch is up-to-date with 'origin/master'.

Updating spec repo `master`
 -> PrivateUIKit (1.0.9)
    - WARN  | source: Git SSH URLs will NOT work for people behind firewalls configured to only allow HTTP, therefore HTTPS is preferred.
    - ERROR | [iOS] unknown: Encountered an unknown error (Must be in the root of the repo (/Users/romantruba/.cocoapods/repos/master), instead in /Users/romantruba/Documents/projects/PrivateUIKit.
/Users/romantruba/.rvm/gems/ruby-2.3.0@global/gems/cocoapods-core-1.0.1/lib/cocoapods-core/source.rb:403:in `ensure_in_repo!'
/Users/romantruba/.rvm/gems/ruby-2.3.0@global/gems/cocoapods-core-1.0.1/lib/cocoapods-core/source.rb:431:in `git_commit_hash'
...

And cocoapods for some reason replaces git remote to https://github.com/CocoaPods/Specs.git

After I installed cocoapods beta 1.1.0, lint is working and validating spec. But after successful finish lint it stores symlinks for all of pod header files in project root directory.

Can you clear out the symlinks in your project root and try again with latest 1.1.0 (rc.2)? I believe those are just left over from the bug you experience with 1.0.1

@benasher44 symlinks in 1.1.0 (rc.2) always created and never deleted after pod lib lint --verbose --sources=PrivateRepo,master --use-libraries --allow-warnings

Hmm that's odd. Thanks for double checking. I'm headed out of town today, but I'll have look at this as soon as I'm back Tuesday.

@benasher44 the whole story is totally odd. Everything was fine 2-3 weeks ago. I didn't update cocoapods from 1.0.0 since everything was ok, until yesterday when it just didn't work. I had made update to 1.0.1 but still no success. I guess, the new Xcode 8 could change some cocoapods behavior, but I'm not totally sure.

Oh yes the original bug was caused by Xcode 8 tools breaking ruby'a Dir.chdir, and we fixed that in 1.1.0.rc.1. The leftover symlinks issue is new though. I'll have a look soon

I met the same problem,everything gone well ,util,I update Xcode to 8.0version, OS X to 10.11.6

I met the same problem.

I back to version 1.0.1 It still error . the Cocoapods changed my project's remote->origin URL......

@cheniuiOSloved @lianweiqin if you're using Xcode 8, you'll need to use CocoaPods 1.1.0.rc.2

@Dreddik can you re-run the command with --no-clean. This should leave the temporary App.xcworkspace around for you to inspect it. Once you have that open, can you paste the contents of any script build phases in the project?

Happened to me too, ended up manually putting the podspec in our Private specs repo ¯_(ツ)_/¯

@benasher44 the App.xcworkspace is in temporary dir. Do you really need those scripts? You need scripts for App build target, or content of scripts in Pods/Target Support Files?

I just can't find anywhere in CocoaPods that makes symlinks like that. It could be in a build phase we generate though

@dantoml @segiddins can the issue that affectedDir.chdir also affect shell cd? The realpath function in the last build phase there cds somewhere and then pwds. If it fails there, realpath could return the wrong thing and presumable exhibit this behavior.

@benasher44 I'd be more surprised if it didn't affect cd than if it did TBH

@benasher44 what code are you referring to?

@segiddins one of the build phases generated during pod install, which is shown in the last gist above in @dreddik's last comment

@Dreddik I pushed a branch called basher_remove_cd to https://github.com/benasher44/CocoaPods that I believe fixes that issue you ran into. Can you give it a try?

PR is now up too

@benasher44 can you share a link how I can make a bin from your code?

If you use a Gemfile, you can put this line in it:

gem 'cocoapods', :git => 'https://github.com/benasher44/CocoaPods', :branch => 'basher_remove_cd'

Checkout bundler.io for more info

@benasher44 I downloaded source, checked out to basher_remove_cd, than I did

$ gem build cocoapods.gemspec 
WARNING:  pessimistic dependency on fourflusher (~> 1.0.1) may be overly strict
  if fourflusher is semantically versioned, use:
    add_runtime_dependency 'fourflusher', '~> 1.0', '>= 1.0.1'
WARNING:  See http://guides.rubygems.org/specification-reference/ for help
  Successfully built RubyGem
  Name: cocoapods
  Version: 1.1.0.rc.2
  File: cocoapods-1.1.0.rc.2.gem
$ gem install cocoapods-1.1.0.rc.2.gem
Successfully installed cocoapods-1.1.0.rc.2
1 gem installed

Issue with symlinks to headers is still there :(

Huh interesting. I'll keep digging.

We run into the same problem today. I think the problem is around def add_file(namespace, relative_header_path, final_name) in headers_store.rb.
@Dreddik I tried to fix it in my fork, it works for me now. Could you give my branch fix/lint-libraries at https://github.com/b-ray/CocoaPods.git a try? :)

I can confirm that @b-ray 's fix is working for me

@b-ray yup looks like you found it. We'd appreciate a PR!

@b-ray yes, it works! 👍

I met the same problem in 1.1.0.beta.2
when i run
pod repo push JOSpecs --sources=https://github.com/CocoaPods/Specs.git,ssh://[email protected]/iOS/JOSpecs.git --allow-warnings

  • ERROR | [iOS] unknown: Encountered an unknown error (Unable to create a source with URL ssh://git@IP/iOS/JOSpecs.git) during validation.

If I run with --verbose, I find that it will clone the JOSpecs to 9-jospecs in current project

Cloning spec repo `9-jospecs` from `ssh://[email protected]/iOS/JOSpecs.git`
  $ /Applications/Xcode.app/Contents/Developer/usr/bin/git clone
  ssh://[email protected]/iOS/JOSpecs.git 9-jospecs
  Cloning into '9-jospecs'...

Then I run again

  • ERROR | [iOS] unknown: Encountered an unknown error (Unable to add a source with url ssh://[email protected]/iOS/JOSpecs.git named 9-jospecs.
    You can try adding it manually in ~/.cocoapods/repos or via pod repo add.) during validation.

The JOSpecs is at ~/.cocoapods/repos correctly

I had same problem on 1.0.1, as workaround I've used old pod version:
pod _0.39_ repo push, it's worked for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pronebird picture pronebird  ·  3Comments

gerchicov-bp picture gerchicov-bp  ·  3Comments

dawnnnnn picture dawnnnnn  ·  3Comments

tlandsmancars picture tlandsmancars  ·  3Comments

iosdev-republicofapps picture iosdev-republicofapps  ·  3Comments