2015-03-19 258 views
1

我在我的服務器上安裝了Gitlab,我無法推送到我創建的新存儲庫。Gitlab-git推送失敗

$ git remote -v 
origin [email protected]:myusername/my-repository.git (fetch) 
origin [email protected]:myusername/my-repository.git (push) 
$ git push -u origin master 

約一分鐘的git push命令掛起,然後錯誤了此消息:

fatal: protocol error: bad line length character: Fail 

我想我的問題可能是得到了與SSH做:

$ ssh -v [email protected] 
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014 
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: /etc/ssh/ssh_config line 19: Applying options for * 
debug1: /etc/ssh/ssh_config line 139: Applying options for example.com 
debug1: /etc/ssh/ssh_config line 142: Applying options for example.com 
debug1: Connecting to example.com [1.2.3.4] port 22. 
debug1: Connection established. 
debug1: identity file /home/myusername/.ssh/id_rsa.pub type 1 
debug1: identity file /home/myusername/.ssh/id_rsa.pub-cert type -1 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2 
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2 
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2 pat OpenSSH_6.6.1* compat 0x04000000 
debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug1: kex: server->client aes128-ctr [email protected] none 
debug1: kex: client->server aes128-ctr [email protected] none 
debug1: sending SSH2_MSG_KEX_ECDH_INIT 
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY 
debug1: Server host key: ECDSA 67:33:0b:d1:72:43:6b:f3:61:b1:9e:22:ef:d7:21:d8 
debug1: Host 'example.com' is known and matches the ECDSA host key. 
debug1: Found key in /home/myusername/.ssh/known_hosts:143 
debug1: ssh_ecdsa_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/myusername/.ssh/id_rsa.pub 
debug1: Server accepts key: pkalg ssh-rsa blen 279 
debug1: Authentication succeeded (publickey). 
Authenticated to example.com ([1.2.3.4]:22). 
debug1: channel 0: new [client-session] 
debug1: Requesting no[email protected] 
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 
debug1: Sending env LC_CTYPE = en_GB.UTF-8 
PTY allocation request failed on channel 0 

注認證似乎成功:

Authenticated to example.com ([1.2.3.4]:22). 

而且我懷疑問題已經得到了與做:

PTY allocation request failed on channel 0 

任何線索?我花了數小時搜索解決方案,但無法解決這個問題。

編輯: 我剛剛發現了這個在gitlab-shell/gitlab-shell.log

W, [2015-03-19T01:41:10.865863 #24346] WARN -- : Failed to connect to internal API <POST https://example.com/api/v3/internal/allowed>: #<Errno::ETIMEDOUT: Connection timed out - connect(2) for "example.com" port 443> 
+0

您怎麼安裝?綜合或手動?內部API看起來很奇怪。我會假設它會是localhost:8080或類似的。 gitlab服務正在運行嗎? gitlab-shell與失敗的gitlab服務器通信。請檢查gitlab-shell配置。 – volker 2015-03-19 01:11:22

+0

'gitlab_url:「http:// localhost:8080 /」'是'.../gitlab-shell/config.yml'中的默認值 – volker 2015-03-19 01:16:15

+0

感謝@volker,將'gitlab_url'設置爲'http:// localhost:8080 /'解決了我的問題。出於某種原因,我已將其更改爲「http:// example.com」。現在所有人都在工作! – kYuZz 2015-03-19 10:55:12

回答

0

我在這方面的專家,而是一個快速搜索告訴我,你要卸載的/ dev /分,然後再次掛載/ dev/pts。

請參見:https://serverfault.com/questions/351162/ssh-fails-pty-allocation-request-failed-on-channel-0

+0

我試過了,但沒有解決我的問題。我認爲我的問題是Gitlab特定的。 – kYuZz 2015-03-19 00:50:02

+0

它看起來像默認的gitlab用戶不應該有一個外殼,並可以配置一個選項線'no-pty'。 Git甚至不需要shell來完成它的工作。事實證明,在錯誤消息'fatal:protocol error:bad line length character:'輸出的前4個字符被打印出來後,如果你可以用ssh登錄,你通常會得到這個錯誤信息。你有輸出一些東西的gitlab用戶的'.bashrc'文件嗎? – KompjoeFriek 2015-03-19 01:14:37