Search code examples
swiftrealmcarthage

Carthage update error: "GitHub API request failed: Bad credentials"


Here is my Cartfile:

# Kanna HTML parsing library
github "tid-kijyun/Kanna" ~> 1.0.0

# Realm database/ORM
github "realm/realm-cocoa"

When I run carthage update I get this:

$ carthage --version
Unrecognized command: '--version'. See `carthage help`.

$ carthage update --platform OSX
*** Fetching realm-cocoa
*** Fetching Kanna
*** Skipped downloading realm-cocoa.framework binary due to the error:
    "GitHub API request failed: Bad credentials"
*** Checking out realm-cocoa at "v0.98.3"
*** Skipped downloading Kanna.framework binary due to the error:
    "GitHub API request failed: Bad credentials"
*** Checking out Kanna at "1.0.5"
*** xcodebuild output can be found in /var/folders/p2/c_d5mx0s3gl45165btrpx1fm0000gn/T/carthage-xcodebuild.KVYEob.log
*** Building scheme "Kanna_OSX" in Kanna.xcworkspace
*** Building scheme "RealmSwift" in RealmExamples.xcworkspace
*** Building scheme "Realm" in RealmExamples.xcworkspace

So it does seem to build both Kanna and Realm, but I'm getting an error about bad GitHub API credentials. What is wrong?


Solution

  • I got the solution in response to a Carthage issue I raised:

    1. Edit ~/.gitconfig and add the following:

      [credential] helper = osxkeychain [credential "https://github.com"] username = willhains

      (Replace willhains with your GitHub user ID.)

    2. Clone a private repo via HTTPS.

    3. OSX will prompt for your GitHub password.

    4. Run carthage update.