Carthage unable to Clone private repos from GitHub

Created on 26 Aug 2016  路  6Comments  路  Source: Carthage/Carthage

  • carthage version: 0.17.2
  • xcodebuild -version: Xcode 7.3.1 Build version 7D1014
  • Are you using --no-build? No
  • Are you using --no-use-binaries? No
  • Are you using --use-submodules? Yes

I recently setup a new Mac, pulled down a few projects and tried to run carthage bootstrap --use-submodules to set them up. However when I did that, I got the following. (I've remove the output from the public repos that work fine).

If I try carthage update --use-submodules or carthage fetch MyPrivateRepo I get the same thing.

However, if I then run carthage build, it seems to build just fine. 馃槙

I found a few old issues regarding this and also tried searching the GitHub help page, but couldn't find anything that fixed my problem. Has anyone got any ideas?

Cartfile

github "MyCompany/MyPrivateRepo" ~> 1.0

Carthage Output

$ carthage bootstrap --use-submodules
*** Cloning MyPrivateRepo
*** Checking out MyPrivateRepo at "1.0.3"
*** Cloning MyPrivateRepo
A shell task (/usr/bin/env git clone --bare --quiet https://github.com/MyCompany/MyPrivateRepo.git /Users/<user>/Library/Caches/org.carthage.CarthageKit/dependencies/MyPrivateRepo) failed with exit code 128:
fatal: could not read Username for 'https://github.com': terminal prompts disabled
question

Most helpful comment

Try cloning your repository directly with git. If you're able to clone with git, then you'll be able to clone with Carthage. (Carthage just uses git's authentication.)

If you're using SSH keys, you'll need to pass the --use-ssh flag to carthage.

All 6 comments

Try cloning your repository directly with git. If you're able to clone with git, then you'll be able to clone with Carthage. (Carthage just uses git's authentication.)

If you're using SSH keys, you'll need to pass the --use-ssh flag to carthage.

@mdiep Yep, sorry, my bad. New computer setup step added to my list. 馃槈 Thanks for the hint.

Any news on the case?

Try cloning your repository directly with git. If you're able to clone with git, then you'll be able to clone with Carthage. (Carthage just uses git's authentication.)

If you're using SSH keys, you'll need to pass the --use-ssh flag to carthage.

This solution does not work for me.

carthage version: 0.26.2
xcodebuild -version: Xcode Version 9.0.1 (9A1004)
Are you using --no-build? No
Are you using --no-use-binaries? No
Are you using --use-submodules? No

Cartfile
git "[email protected]:rob-nash/Dequable.git" "master"
or
github "rob-nash/Dequable.git" "master"

Roberts-iMac:Records robertnash$ cd ~/Desktop/
Roberts-iMac:Desktop robertnash$ git clone [email protected]:rob-nash/Dequable.git
Cloning into 'Dequable'...
remote: Counting objects: 96, done.
remote: Compressing objects: 100% (54/54), done.
remote: Total 96 (delta 35), reused 96 (delta 35), pack-reused 0
Receiving objects: 100% (96/96), 184.64 KiB | 634.00 KiB/s, done.
Resolving deltas: 100% (35/35), done.
Roberts-iMac:Desktop robertnash$

Roberts-iMac:Records robertnash$ carthage update --use-ssh
* Fetching Dequable
A shell task (/usr/bin/env git fetch --prune --quiet origin refs/tags/:refs/tags/ +refs/heads/:refs/heads/ (launched in /Users/robertnash/Library/Caches/org.carthage.CarthageKit/dependencies/Dequable)) failed with exit code 128:
fatal: could not read Username for 'https://github.com': terminal prompts disabled

Since this is quite high up on google, here is how I got it working by saving the HTTPS password in the Keychain:

1) Configure ssh to store passwords in keychain

```sh
git config --global credential.helper osxkeychain
```

2) Create a token for logging in (used instead of the password)

https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/

3) Clone any private repo anywhere, and log in using username + token

```sh
$ git clone https://github.com/username/repo.git
Username: your_username
Password: your_token
```

4) You should now be able to use Carthage with private repo without any special flags

Was this page helpful?
0 / 5 - 0 ratings