Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gitlab-git推送失败_Gitlab - Fatal编程技术网

Gitlab-git推送失败

Gitlab-git推送失败,gitlab,Gitlab,我已经在服务器上安装了Gitlab,无法推送到我创建的新存储库 $ git remote -v origin gitlab@example.com:myusername/my-repository.git (fetch) origin gitlab@example.com:myusername/my-repository.git (push) $ git push -u origin master git push命令将挂起约一分钟,然后出错并显示以下消息: fatal: protocol

我已经在服务器上安装了Gitlab,无法推送到我创建的新存储库

$ git remote -v
origin  gitlab@example.com:myusername/my-repository.git (fetch)
origin  gitlab@example.com:myusername/my-repository.git (push)
$ git push -u origin master
git push
命令将挂起约一分钟,然后出错并显示以下消息:

fatal: protocol error: bad line length character: Fail
我认为我的问题可能与SSH有关:

$ ssh -v gitlab@example.com
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 hmac-md5-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com 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-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
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>
W[2015-03-19T01:41:10.865863#24346]警告--:无法连接到内部API:#

我不是这方面的专家,但快速搜索告诉我应该卸载/dev/pts,然后再次装载/dev/pts


请看:

我试过了,但没有解决我的问题。我认为我的问题是特定于Gitlab的。看起来默认Gitlab用户不应该有shell,并且可以配置一个选项行
no pty
。Git甚至不需要一个shell来完成它的工作。结果是,在错误消息
fatal:protocol error:bad line length character:
之后,输出的前4个字符被打印出来,如果您可以使用ssh登录,通常会得到这些字符。您是否为gitlab用户提供了一个输出内容的
.bashrc
文件?您是如何安装它的?综合还是手动?内部API看起来很奇怪。我会假设它是localhost:8080或类似的。gitlab服务正在运行吗?gitlab shell与发生故障的gitlab服务器通信。请检查gitlab shell配置。
gitlab\u url:http://localhost:8080/“
../gitlab shell/config.yml中的默认值
谢谢@volker,将
gitlab\u url
设置为
http://localhost:8080/
修复了我的问题。出于某种原因,我把它改成了
http://example.com
。现在大家都在工作!