2016-03-04 86 views
4

這是我Cartfile:迦太基更新錯誤: 「GitHub的API請求失敗:壞憑據」

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

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

當我運行carthage update我得到這個:

$ 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 

所以它似乎建立兩Kanna和Realm,但是我收到有關錯誤的GitHub API憑據的錯誤。哪裏不對?

+0

迦太基哪個版本您使用的?你可以通過運行'carthage version'來確定它。 – jpsim

+0

@jpsim'carthage version'說'0.15'。 –

+1

我不是迦太基專家,但是從錯誤消息來看,它會出現你的GitHub API證書無效。從閱讀Carthage的源代碼(https://github.com/Carthage/Carthage/blob/0.15/Source/CarthageKit/GitHub.swift#L378-L409),它會顯示它使用'GITHUB_ACCESS_TOKEN'來驗證GitHub API請求。您是否將此值設置爲環境變量?如果是這樣,它是一個有效的標誌?您最近是否在GitHub.com上撤銷了此令牌?如果您的令牌有效並且未被撤消,我建議您向迦太基項目提出問題,因爲這可能是一個錯誤。 – jpsim

回答

3

我得到了響應的解決了Carthage issue我提出:

  1. 編輯~/.gitconfig並添加以下內容:(更換willhains與你的GitHub用戶ID)

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

  2. 通過HTTPS克隆私人回購。

  3. OSX會提示輸入您的GitHub密碼。

  4. 運行carthage update

+0

無法打開〜/ .gitconfig,權限被拒絕。 – coreDeviOS

+0

@coreDeviOS打開該文件時使用'sudo'命令。請注意,您需要使用某些文本編輯器打開文件。例如,你可以使用內置的nano編輯器: 'sudo nano〜/ .gitconfig' –

0

如果你想跳過尋找二進制文件和從源代碼只是建立:

carthage update --no-use-binaries