7

我已经在 Ubuntu 服务器上安装了 GitLab。一切似乎都很好,除了我无法向/从服务器推送/拉取/克隆。

当我推送时,我收到一般错误消息:

fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我已经尝试了数小时的谷歌搜索,但我似乎无法找到问题所在。

sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production

运行良好,全线OK!

我可以通过 SSH 访问 git@adress.adress 我得到:

PTY allocation request failed on channel 0
Welcome to GitLab, Anonymous!

当我做:

ssh git@adress.adress "ls /location/of/git/dir"

我得到:

Not allowed command

该网站正在运行,当我在该网站上创建一个存储库时,它出现在 /home/git/repository/

但我仍然无法推动它。

我遵循了本指南:

https://github.com/gitlabhq/gitlabhq/blob/5-0-stable/doc/install/installation.md

和本指南让它在 apache 上运行:

http://shanetully.com/2012/08/running-gitlab-from-a-subdirectory-on-apache/

4

6 回答 6

7

经过数小时的调试后,我终于弄明白了,我不知何故知道配置存在一个简单的问题。

由于第二个指南提到了如何使用相对 url 在 apache 上设置 gitlab,因此您实际上必须在 gitlab 中进行更多配置。我取消了关于相对 url:s unicorn.rb 的注释,并在 gitlab-shell/config 中添加了我的整个 URL(带有子目录)。

前:

 http://web-adress.com/

后:

 http://web-adress.com/subdomain/

现在效果很好。

于 2013-04-06T17:23:56.207 回答
4

您可以使用下面的命令对其进行测试。当你登录时,它应该说你的名字。

ssh -T git@myserver.com

欢迎来到 GitLab,Christian Hammer!

如果它说“欢迎来到 GitLab,匿名!” gitlab 不承认你是 gitlab 的用户。

于 2013-09-27T15:57:18.210 回答
2

我不知道你是否已经解决了这个问题,但我发现如果我用我在 gitlab 中使用的电子邮件地址生成一个密钥,这个过程就可以工作。我采取的步骤:

ssh-keygen -t rsa -C "#email address#"

使用提供的电子邮件创建新的 ssh 密钥。

生成公钥/私钥 RSA 密钥对。

接下来只需使用下面的代码转储您的公钥并添加到 GitLab SSH 密钥

cat ~/.ssh/#key name#.pub

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6eNtGpNGwstc....*
于 2013-09-27T15:38:09.407 回答
2

为了更准确地了解已接受的答案(“Joakim Engstrom”的“4 月 6 日 17:23 回答”和“7 月 21 日 10:07 编辑”):

您很可能处于更新 Gitlab 以适应您自己的上下文路径的情况(即从http://localhost/<my_context_path>和 not访问它http://localhost)。

在这个的操作方法中,没有提到还要修改这个 gitlab-shell 配置文件:

// logout any Gitlab open session, stop your Gitlab service, and your possible third-party webserver first  
$ sudo service apache2 stop  
$ sudo service gitlab stop  

// perform the modification that fixes it, if you indeed configured Gitlab to be accessed with a custom context path  
$ sudo -u git -H nano ~git/gitlab-shell/config.yml  

# Url to gitlab instance. Used for api calls. Should end with a slash.
-gitlab_url: "http://localhost/"
+gitlab_url: "http://localhost/<my_context_path>/"

// restart services  
$ sudo service gitlab start  
$ sudo service apache2 start  

// Try to push again from your particular Gitlab user local repository, to the Gitlab remote repository    
$ cd <path_to_my_local_repository>  
$ sudo -u <OS_username_that_owns_the_local_repository> -H git push -u origin master  
Counting objects: 3202, done.  
Delta compression using up to 2 threads.  
Compressing objects: 100% (3115/3115), done.  
Writing objects: 100% (3202/3202), 11.56 MiB | 5.34 MiB/s, done.  
Total 3202 (delta 609), reused 0 (delta 0)  
To `git@<my_FQDN>:<my_Gitlab_user_or_group_name>/<my_gitlab_project_ID>.git`  
  * [new branch]      master -> master  
Branch master set up to track remote branch master from origin.  
$   

关于“类似于 stackoverflow.com/questions/13071234/… – Paul Verest 7 月 18 日 6:20”(无法推送到新的 gitlab 安装):
不,这不是本页主题中的同一个问题。

于 2013-10-19T17:38:59.727 回答
0

在我的情况下,原因是 nginx 强制重定向到 https。通过运行检查 git 用户是否可以使用 gitlab-api

sudo -u git -H /home/git/gitlab-shell/bin/check

在服务器上。在我的情况下,输出是

Check GitLab API access: FAILED. code: 301

我不得不gitlab_url改变/home/git/gitlab-shell/config.ymlhttps://<domain>

于 2015-07-09T17:37:21.383 回答
0

对我来说,这是因为我在 /etc/ssh/sshd_config AllowUsers git 中限制了谁可以 ssh 进入我的服务器

于 2016-05-22T01:51:31.577 回答