I\'ve installed GitLab on an Ubuntu Server. Everything seems to work fine except I can\'t push/pull/clone to/from the server.
When I push I get the general error message
I do not know if you have resolved this yet but what I found is if I generate a key with the email address I used in gitlab the process works. Steps I took:
ssh-keygen -t rsa -C "#email address#"
Creates a new ssh key using the provided email.
Generates public/private RSA key pair.
Next just use code below to dump your public key and add to GitLab SSH Keys
cat ~/.ssh/#key name#.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6eNtGpNGwstc....*
In my case the reason was an enforced redirect to https by nginx. Check if the git user can use the gitlab-api by running
sudo -u git -H /home/git/gitlab-shell/bin/check
on the server. In my case the output was
Check GitLab API access: FAILED. code: 301
I had to change the gitlab_url
in /home/git/gitlab-shell/config.yml
to https://<domain>
You can test it with the command bellow. When you login it should say your name.
ssh -T git@myserver.com
Welcome to GitLab, Christian Hammer!
If it says "Welcome to GitLab, Anonymous!" gitlab does not recognise you as a user of gitlab.
for me it was because i had restricted who could ssh into my server in /etc/ssh/sshd_config AllowUsers git
I finally figured it out after many hours of debugging, and I somehow knew there was a simple issue with the configuration.
Since the second guide mention how to set up gitlab on apache with a relative url you actually have to do some more configs inside gitlab. I uncommented the line about relative url:s unicorn.rb and in gitlab-shell/config I added my whole URL (with subdirectory).
Before:
http://web-adress.com/
after:
http://web-adress.com/subdomain/
Now it works great.
To be more precise regarding the accepted answer ("answered Apr 6 at 17:23" and "edited Jul 21 at 10:07" by "Joakim Engstrom"):
You're most probably in the situation where you updated Gitlab to fit your own context path (that's accessing it from http://localhost/<my_context_path>
and not http://localhost
).
In the how-tos for this, is not mentionned to also modify this gitlab-shell configuration file:
// 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.
$
About "similar to stackoverflow.com/questions/13071234/… – Paul Verest Jul 18 at 6:20" (Can't push to new gitlab install):
No, this is not the same issue in this page topic.