fbpx

Sourcetree推檔案失敗,無法Push到Github?

推檔案失敗造成無法Push到Github的原因有很多,以下是最笨但我又最常發生的狀況,跟我一起排錯吧。


Push 錯誤訊息如下:

“`
git –no-optional-locks -c color.branch=false -c color.diff=false -c color.status=false -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree push -v origin refs/heads/master:refs/heads/master

Pushing to https://username@github.com/peirren/Geek-Log.git

User cancelled password prompt.remote: Invalid username or password.

fatal: Authentication failed for ‘https://username@github.com/project’

Completed with errors, see above
“`

其實意思很簡單,就是密碼錯誤了。

但問題是,之前Push時一切正常,為何時不時會跳出惱人的Error呢?

進入帳號選項

我感覺 GitHub 跟 SourceTree 沒有很對盤,如果是 Bitbucket 或 GitLab 相容性比較正常。

反正不管,進入選項到帳戶頁籤(Tab),「cmd+,」

SourceTree 帳戶選項調整
SourceTree 帳戶選項調整

更改授權方式為 Basic

捨棄用OAuth的方式,連結帳號(Connect Account)連半天都是失敗的,今天成功了,過幾天又失敗。乾脆直接改為 Basic連線,壞處就是每次Push或Pull的時候,都會再輸入一次密碼。但至少這樣是行得通的。

如果有人有相同問題,有解方麻煩告訴我怎麼解,感恩。

SourceTree 建議連線到 GitHub 時都用Basic
建議連線到 GitHub 時都用Basic

 

Leave a Reply

Your email address will not be published. Required fields are marked *