簡體   English   中英

GitLab 5.0:通過SSH的Git推送失敗,但沒有HTTPS或直接SSH連接的錯誤

[英]GitLab 5.0: Git push via SSH fails, but no errors with HTTPS or with direct SSH connection

當我嘗試git push時,我得到了通常的錯誤

致命:無法從遠程存儲庫讀取。

請確保您具有正確的訪問權限並且存儲庫存在。

但是,推送和拉動通過HTTPS工作正常。

我認為這將是SSH的問題,但是連接似乎沒有產生任何錯誤,它接受我的公鑰,給我歡迎消息並退出0。

$ ssh -vT git@git.server.com
OpenSSH_5.9p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /Users/adam/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to git.server.com [420.420.555.555] port 22.
debug1: Connection established.
debug1: identity file /Users/adam/.ssh/id_rsa type 1
debug1: identity file /Users/adam/.ssh/id_rsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.0p1 Debian-3ubuntu1
debug1: match: OpenSSH_6.0p1 Debian-3ubuntu1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9
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: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 96:cc:........
debug1: Host 'git.server.com' is known and matches the RSA host key.
debug1: Found key in /Users/adam/.ssh/known_hosts:2
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: /Users/adam/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to git.server.com ([257.257.257.257]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Remote: Forced command.
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Remote: Forced command.
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Sending environment.
debug1: Sending env LANG = en_GB.UTF-8
Welcome to GitLab, !
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2512, received 2968 bytes, in 0.5 seconds
Bytes per second: sent 5567.4, received 6578.0
debug1: Exit status 0

但是,運行此命令失敗

ssh git@git.server.com "ls /home/git/repositories/adam/my-repo.git"

這看起來像當前的錯誤3424

你需要確保:

  • Gitlab應用程序(與sidekiq消費者)和Redis已經啟動
  • 配置是正確的

配置問題示例:

放松一下並查看我的所有配置文件后,我發現了我的問題,這當然是我的錯

在我配置服務器時不假思索,在/etc/hosts文件中,我將名稱xmcom添加到環回IP地址(127.0.0.1)。
因此,在我的本地服務器上執行的任何網絡調用將轉到該IP而不是NginX實際綁定到GitLab服務器的IP。

其他例子:

通過更改nginx配置以偵聽*:80而不是特定IP,我能夠解決我的問題。 顯然由於防火牆內部和外部IP不同。

listen *:80 default_server;

issue / 3384中詳細討論了最后一個配置錯誤。


正如OP Adam-E評論中報告的那樣,最后一個版本5.1有助於執行以下步驟:

  • 將Apache2替換為nginx,
  • 剛剛發布的GitLab 5.1穩定版和干凈安裝
  • 截斷/home/git/.ssh/authorized_keys
  • 讀了我的公鑰。

從最后一步開始工作。

暫無
暫無

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

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