gitlab配置ssh key及sourcetree Error reading SSH_ASKPASS

gitlab配置ssh key及sourcetree Error reading SSH_ASKPASS

在使用 SourceTree 推送到gitlab時一直報:Error reading SSH_ASKPASS output for prompt: [email protected]’s password:
fatal: Could not read from remote repository.而使用命令行模式居然可以,一直很納悶這個問題,於是開始折騰。發現原來設置默認的SSH客戶端是putty/plink,而命令行模式使用的是git bash。

異常信息

git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags --set-upstream origin develop:develop
Pushing to [email protected]:xx/xx-parent.git
Error reading SSH_ASKPASS output for prompt: [email protected]'s password: 
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.


完成時帶有錯誤,見上文。

解決步驟

1.SourceTree 工具->選項
在這裏插入圖片描述
2. 選擇SSH客戶端 爲OpenSSH在這裏插入圖片描述
由於我之前就已經配置好gitlab的SSH祕鑰,我找個問題是更換Windows系統用戶導致的,所以到此問題解決。如果沒有配置gitlab或GitHub SSH祕鑰,以gitlab爲例操作步驟如下:

1、打開Git bash 輸入 ssh-keygen -t rsa -C “[email protected]” 生成SSH祕鑰,文件生成在~/.ssh目錄下可以通過cmd cd ~/.ssh找到
在這裏插入圖片描述
2、然後用記事本打開~/.ssh/id_rsa.pub文件複製內容
在這裏插入圖片描述
3、打開gitlab,找到(不同版本的gitlab位置不一樣)Profile Settings–>SSH Keys—>Add SSH Key,並把上一步中複製的內容粘貼到Key所對應的文本框,在Title對應的文本框中給這個sshkey設置一個名字,點擊Add key按鈕,操作完成
在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章