2016-10-05 66 views
1

我有一個使用git的問題。當我試圖訪問存儲庫時,git會自動提示輸入密碼,即使通過密碼的auth在gitserver上被禁用。即使Git使用密鑰驗證進行設置,Git也需要密碼

我的ssh配置如下(主機/存儲庫是匿名):

host gitserver 
    user gitolite 
    hostname server.example.com 
    identityfile ~/.ssh/gitolite 

當我嘗試但是克隆回購它的失敗,由於密碼請求:

git clone [email protected]:repository 
Cloning into 'repository'... 
[email protected]'s password: 

的〜/ .ssh文件夾,以及其內容設置與權限700所述here(我嘗試了很多東西之一)。

任何人有一個解決的辦法?

編輯:

其他嘗試克隆失敗完全相同的方式

git clone gitserver:repository 
Cloning into 'repository'... 
[email protected]'s password: 

EDIT2:

ssh -Tv gitserver 

結果如下輸出:

debug1: Reading configuration data /home/username/.ssh/config 
debug1: /home/username/.ssh/config line 1: Applying options for gitserver 
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: /etc/ssh/ssh_config line 19: Applying options for * 
debug1: Connecting to server.example.com [1.2.3.4] port 22. 
debug1: Connection established. 
debug1: identity file /home/username/.ssh/gitolite type 1 
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048 
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048 
debug1: identity file /home/username/.ssh/gitolite-cert type -1 
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.0p1 Debian-4 
debug1: match: OpenSSH_6.0p1 Debian-4 pat OpenSSH* 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_6.0p1 Debian-4 
debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug1: kex: server->client aes128-ctr hmac-md5 none 
debug1: kex: client->server aes128-ctr hmac-md5 none 
debug1: sending SSH2_MSG_KEX_ECDH_INIT 
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY 
debug1: Server host key: RSA 00:df:a5:58:af:45:be:eb:62:65:07:5d:85:20:7c:98 
debug1: Host 'server.example.com' is known and matches the RSA host key. 
debug1: Found key in /home/username/.ssh/known_hosts:1 
debug1: ssh_rsa_verify: signature correct 
debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS 
debug1: SSH2_MSG_NEWKEYS received 
debug1: Roaming not allowed by server 
debug1: SSH2_MSG_SERVICE_REQUEST sent 
debug1: SSH2_MSG_SERVICE_ACCEPT received 
debug1: Authentications that can continue: publickey,password 
debug1: Next authentication method: publickey 
debug1: Offering RSA public key: /home/username/.ssh/gitolite 
debug1: Authentications that can continue: publickey,password 
debug1: Offering RSA public key: /home/username/.ssh/gitolite 
debug1: Authentications that can continue: publickey,password 
debug1: Next authentication method: password 
[email protected]'s password: 
+1

我很困惑,因爲你必須在配置文件中「用戶混帳」,並且也通過不同的用戶與git克隆(gitolite @)。也許這就是爲什麼它不使用配置。 – RemcoGerlich

+0

它也看起來像你使用不同的主機名(命令行上的'server.example.com',但配置中的'gitserver')。 – robertklep

+0

@RemcoGerlich那是在問題SRY一個錯字,我糾正一個 – Taredon

回答

1

想通了密碼提示的原因。

這是應該增加的git支持的文件大小爲gitolite較早的命令顯然,一個無法運行,導致以下爲被卡在隊列gitolite關鍵更新。

因此~/.ssh/known_hosts從未更新由gitolite在服務器端,從而在關鍵的衰落。

+0

不錯的反饋。 +1。感謝您讓我們所有人知道問題所在。 – VonC

1

如果你想使用gitolite使用的私鑰,ssh的URL必須是:

git clone gitserver:repository 

將使用~/.ssh/gitolite私鑰,您標識爲gitolite服務器上的git。

+0

不幸的是,我之前也試過這種情況,導致了完全相同的情況。 – Taredon

+0

然後嘗試'ssh -Tv gitserver':這是否工作?只要它不起作用,就不可能有gitolite操作。請注意,使用此特定密鑰對克隆gitolite-admin非常有用。它不應該用來克隆由Gitolilte管理的任何git Repo。 – VonC

+0

'[email protected]:repository'與'gitserver:repository'不同:第一個依賴於默認的'id_rsa(.pub)'ssh密鑰。第二個使用gitolite私鑰。 – VonC

相關問題