如何在推送到新存储库时解决“GitLab:API无法访问”?

时间:2015-07-22 17:01:21

标签: gitlab

我们在我的工作地点有一个本地托管的GitLab企业版(目前在v7.12.00-ee ceb5083)。我可以通过GUI创建存储库而不会出现问题。但是当我尝试向存储库添加任何内容时,我收到此错误:

D:\ws\testing [master]> git push -u origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 219 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: GitLab: API is not accessible
To http://gitlab.ops.cld/duffrw/testing.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'http://gitlab.ops.cld/duffrw/testing.git'

我在/var/log/gitlab/gitlab-shell/gitlab-shell.log文件中看到API没有响应,并且给出了“内部服务器错误”:

E, [2015-07-22T16:05:51.812454 #15110] ERROR -- : API call <POST http://127.0.0.1:8080/api/v3/internal/allowed> failed: 500 => <{"message":"500 Internal Server Error"}>.

几个问题......我在哪里可以离开?必须有某种服务提供商没有运行。为什么不?它叫什么?我该如何开始?

我检查了/var/log/gitlab/nginx/gitlab_access.log并发现了这些行,但我没有看到任何有趣的内容:

172.31.201.164 - - [22/Jul/2015:16:05:50 +0000] "GET /duffrw/testing.git/info/refs?service=git-receive-pack HTTP/1.1" 401 0 "-" "git/1.9.5.msysgit.1"
172.31.201.164 - - [22/Jul/2015:16:05:50 +0000] "GET /duffrw/testing.git/info/refs?service=git-receive-pack HTTP/1.1" 401 0 "-" "git/1.9.5.msysgit.1"
172.31.201.164 - duffrw [22/Jul/2015:16:05:51 +0000] "GET /duffrw/testing.git/info/refs?service=git-receive-pack HTTP/1.1" 200 179 "-" "git/1.9.5.msysgit.1"
172.31.201.164 - duffrw [22/Jul/2015:16:05:51 +0000] "POST /duffrw/testing.git/git-receive-pack HTTP/1.1" 200 124 "-" "git/1.9.5.msysgit.1"

/var/log/gitlab/nginx/gitlab_error.log中推送此存储库没有任何错误,/var/log/gitlab/nginx/error.log完全为空。

我错过了什么?

更新

使用gitlab-ctl tail命令非常方便!它显示了一个堆栈跟踪,我发送给GitLab,他们告诉我这是7.12.00中的错误。它固定在7.13.00。

7 个答案:

答案 0 :(得分:22)

如果使用gitlab.com,则服务器正在更新或出现问题。

您可以查看https://status.gitlab.com以获取GitLab团队的更新。

您还可以关注Twitter帐户:https://twitter.com/gitlabstatus

答案 1 :(得分:6)

您必须在GitLab的配置文件中为GitLab API设置正确的URL。

正如我们在gitlab-shell.log中看到的,您的API地址目前设置为http://127.0.0.1:8080/。如果更改运行GitLab的默认URL或更改了其默认端口,则必须更改它。

此参数可在/etc/gitlab/gitlab.rb中配置:

## GitLab URL
##! URL on which GitLab will be reachable.
##! For more details on configuring external_url see:
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
external_url 'http://127.0.0.1:3000'
[...]

这是默认值(因为端口3000unicorn的GitLab综合中的默认值。更新后,您必须运行sudo gitlab-ctl reconfigure才能应用此参数。

它将覆盖文件opt/gitlab/embedded/service/gitlab-shell/config.yml,如其标题评论中所述。

答案 2 :(得分:4)

我们在&#34;计算引擎&#34;上托管我们的gitlab时遇到过这个问题。来自谷歌云。 这种行为的原因是没有&#34;交换&#34;在我们的机器中配置。 Gitlab无法分配额外的内存。

我们决定扩大内存而不是创建交换分区,但这是您的选择...... :)

答案 3 :(得分:2)

我曾经在gitlab.com上遇到过这个问题,但这不是可靠性,只是我试图用--force推送到master分支,并且它是受保护的(请参阅的设置中的“受保护的分支”存储库)。

答案 4 :(得分:1)

我们最近经常遇到这种情况。它肯定是GitLab耗尽内存。我们还无法确定GitLab是否泄漏了内存,或者我们的服务器实例是否配置不足。

答案 5 :(得分:1)

重启gitlab服务修复我的问题。

sudo gitlab-ctl restart

sudo gitlab-ctl reconfigure

答案 6 :(得分:0)

我在Bitnami遇到了同样的问题。我重新启动了所有内容并使用

解决了这个问题
/opt/bitnami/ctlscript.sh restart
相关问题