Carthage update/bootstrap from private github repo with ssh.

Created on 17 Jul 2018  路  10Comments  路  Source: Carthage/Carthage

  • carthage install method: [ ] .pkg, [X ] homebrew, [ ] source
  • which carthage: bootstrap
  • carthage version: 0.30.1
  • xcodebuild -version: Xcode 9.4
  • Are you using --no-build? No
  • Are you using --no-use-binaries? No
  • Are you using --use-submodules? No
  • Are you using --cache-builds? No
  • Are you using --new-resolver? No

Cartfile

github "Hearst-DD/ObjectMapper" "3.1.0"
github "antitypical/Result" "3.2.4"
github "Quick/Nimble" "v7.0.3"
github "Quick/Quick" "v1.2.0"
github "AliSoftware/OHHTTPStubs" "6.1.0"
// or any combination here with HTTPS
git "ssh://[email protected]:company/repo_name" == 1.0.2

Carthage Output

ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Actual outcome

Expected outcome
Update carthage using ssh. This is private / enterprise account. As I have also my private account, I use ssh config file like this:

    Host companyname.github.com
    HostName github.com
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa_github_companyname

    Host github.com
    HostName github.com
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa

Carthage can't update private repos. How to solve this?

question stale

Most helpful comment

Yes, my command:
carthage update --use-ssh --no-use-binaries --platform iOS --cache-builds or
carthage bootstrap --use-ssh --no-use-binaries --platform iOS --cache-builds

All 10 comments

Are you sure that normal git clone with git clone ssh://[email protected]:company/repo_name works correctly?

You should also check the GitHub's document: https://help.github.com/articles/connecting-to-github-with-ssh/.

It works, as it is defined in here:
Host companyname.github.com HostName github.com
This way git knows that companyname.github.com is also github.com, but with different ssh key.
Cloning using git in terminal works perfect, but carthage can't do that, so I removed my private ssh key and set one key for github - this not resolve issue. I would like to have multiple accounts in github with different ssh keys, and ssh config (plus ssh-add all keys) should be enough.

Here is example how to do this:
https://medium.com/@trionkidnapper/ssh-keys-with-multiple-github-accounts-c67db56f191e

As you see, this is the case, two accounts with ssh :D

Are you sure you need the ssh:// scheme?

git "[email protected]:/Foo/bar.git" == 1.0.0

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

I need ssh as it is for CI machine also, so writing password on HTTP isn't very usefull

Have you tried the --use-ssh flag?

Yes, my command:
carthage update --use-ssh --no-use-binaries --platform iOS --cache-builds or
carthage bootstrap --use-ssh --no-use-binaries --platform iOS --cache-builds

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings