簡體   English   中英

git ssh使用gitlab要求輸入密碼

[英]git ssh ask for a password with gitlab

我最近在我的Ubuntu上安裝了專用的Gitlab服務器。

Webapp運行正常,安裝過程中沒有問題(在生產環境之前在VM上進行了測試)

我從帳戶上的Web應用程序升級了ssh rsa私鑰,並創建了一個項目,並從另一個存儲庫克隆。

在我的桌面環境中,我嘗試使用ssh進行git pull。 第一次登錄時,我必須接受ssh指紋,然后,直到現在,服務器一直要求我以git用戶身份登錄,該用戶沒有密碼。

D:/drive/project> git pull git@0.0.0.0:me/project.git
git@0.0.0.0's password:
Connection closed by 0.0.0.0
fatal: Could not read from remote repository.

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

D:\skydrive\artmoser>git pull
git@0.0.0.0's password: [tried to type something]
Permission denied, please try again.
git@0.0.0.0's password:
Permission denied, please try again.
git@0.0.0.0's password:
^C

我在Windows下的ssh公鑰和私鑰在C:\\ Users \\ Jack Bauer.ssh中,在專用服務器上,我可以在/home/git/.ssh/authorized_keys中看到我的密鑰

我已經檢查了我的chmod用戶git:

drwx--x--x  7 git     git     4096 mai   31 05:06 git/
drwx------  2 git  git  4096 juin   1 03:27 git/.ssh/
-rw------- 1 git git  508 juin   1 02:53 git/.ssh/authorized_keys

我究竟做錯了什么 ?

編輯

經過更多研究:

如果我使用膩子用git用戶登錄,則會收到此錯誤消息, server refused to allocate pty

如果我嘗試執行ssh git@0.0.0.0 ,他們會在git用戶密碼(沒有密碼)之前3次要求我輸入密碼

如果我使用ssh git@0.0.0.0 -Tvvv進行ssh隧道,則會在日志末尾出現此錯誤

debug1: Next authentication method: publickey
debug1: Trying private key: /home/me/.ssh/id_rsa
debug1: key_parse_private2: missing begin marker
debug1: key_parse_private_pem: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Enter passphrase for key '/home/me/.ssh/id_rsa':

公鑰在我的計算機上,私鑰在服務器上,

如果要使用ssh訪問服務器,則客戶端(在此為Windows工作站)必須至少具有私鑰(將公鑰和私鑰對應的密鑰保留在一起是一種很好的做法)。

C:\Users\Jack Bauer\.ssh\id_rsa.pub
C:\Users\Jack Bauer\.ssh\id_rsa

如果您的密鑰不遵循此默認命名約定,則需要一個C:\\Users\\Jack Bauer\\.ssh\\config文件(如此處所示

鍵入這些命令時,請確保在Windows Shell中將HOME環境變量設置為C:\\Users\\Jack Bauer如果您啟動git-cmd.exeGit For Windows發行版隨附) ,就是這種情況。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM