Sourcetree: Could not read Username解決辦法

雷哥的開發碎嘴頻道
2 min readJul 30, 2019

--

最近使用Sourcetree與GitLab平台進行git flow的互動,突然無法進行finish feature的操作了。
明明之前都還可以正常運作、現在也都還可以進行fetch、pull、push等基礎git操作,但是使用git flow的finish feature時就會報錯:

git flow feature finish my-feature
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://gitlab.com': Invalid argument
Fatal: Could not fetch feature/my-feature from origin.
Completed with errors, see above.

這現象真的很奇怪,著實折騰了我好一陣子。

網路上有人建議將remote網址前面加上帳號密碼就可以讀取,例如

https://username:password@gitlab.com

但我實在不想要帳號密碼外露呀。所以我繼續尋找解答…

最後是參考這篇山水相逢z的簡書文章(實際上是這篇stack overflow)得到解決的。

解決方法

從Sourcetree前往Options (Windows / Mac版本可能有所不同)
到Git分頁
Git Version欄位,按下 'System' 開關
儲存設定 (點選右下角的OK)
示範操作
在Options的Git分頁下,切換Git Version到System

這樣就好了。

聽說是因為Git或Sourcetree更新後,Sourcetree會忘記如何使用Git的一個bug…有夠詭異的。

我是雷哥,一位萌新開發者。歡迎與我交流、討論遊戲與Android App開發技巧。如果我的文章有幫助到您,也請不吝給點掌聲 :)

--

--

雷哥的開發碎嘴頻道
雷哥的開發碎嘴頻道

Written by 雷哥的開發碎嘴頻道

站在人生十字路口的萌新開發者。喜歡遊戲開發與安卓App開發。擅長嘴炮與胡思亂想。

No responses yet