You are not logged in.

#1 2016-11-25 22:44:19

yorrd
Member
Registered: 2013-07-21
Posts: 71

[SOLVED] Gitlab configuration mistake, 401 Unauthorized

Hey y'all. I'm installing gitlab with apache and the recommended workhorse service on a subdomain of mine. I followed the archwiki guide on gitlab, but I seem to be overlooking something. Whenever I try to clone the repository via ssh (copying the command from gitlab), it gives me

I, [2016-11-25T23:29:19.314965 #31146]  INFO -- : POST http://localhost:8080/api/v3/internal/allowed 5.05497
E, [2016-11-25T23:29:19.315458 #31146] ERROR -- : API call <POST http://localhost:8080/api/v3/internal/allowed> failed: 401 => <{"message":"401 Unauthorized"}>.
W, [2016-11-25T23:29:19.319566 #31146]  WARN -- : gitlab-shell: Access denied for git command <git-upload-pack '/root/ProjectSky.git'> by user with key key-2.

There is no more error logging happening in either the log directory or the journalctl log output. This suggests that the user doesn't have access to that specific repository. However, I have added the ssh key of my machine to my user account and the repository is set to public for testing purposes. Cloning via https does work, any git action (pushing for example) doesn't work.

Is there another reason the 401 Unauthorized error might be thrown besides the user actually not having permissions (which he does I believe)?

I don't want to post all config files here since I think there's no way to collapse them. Let me know what might be of interest here. unicorn listens on port 8080, workhorse listens on 8081 - both of them seem to work as far as I can tell from using the web interface.

EDIT2: Even thought the website works **completely fine**, the check script says this:

Running /usr/share/webapps/gitlab-shell/bin/check
Check GitLab API access: FAILED. code: 401
gitlab-shell self-check failed

Meanwhile in the gitlab-shell.log:

API call <GET http://localhost:8080/api/v3/internal/check> failed: 401 => <{"message":"401 Unauthorized"}>.

- no other logs are showing errors

EDIT: The error shown when cloning on the client ist

Cloning into 'testproj'...
GitLab: API is not accessible
fatal: Could not read from remote repository.

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

Last edited by yorrd (2016-12-01 18:22:06)

Offline

#2 2016-11-27 19:23:45

yorrd
Member
Registered: 2013-07-21
Posts: 71

Re: [SOLVED] Gitlab configuration mistake, 401 Unauthorized

Some new information, the website works fine, even though the shell script fails. Any ideas about this? I don't think this should be allowed to happen. Please see the edits on the original post for further information.

Offline

#3 2016-12-01 04:17:33

gmk
Member
Registered: 2015-03-08
Posts: 8

Re: [SOLVED] Gitlab configuration mistake, 401 Unauthorized

Not sure if still current, but maybe this will help:

https://wiki.archlinux.org/index.php/gi … API_access
Make 100% sure, that the files /etc/webapps/gitlab/secret and /etc/webapps/gitlab-shell/secret files contain something!

https://wiki.archlinux.org/index.php/gi … t_is_empty
This file is usually generated while installing the gitlab-shell and the gitlab packages, but in some cases it may need to be generated manually.
# hexdump -v -n 64 -e '1/1 "%02x"' /dev/urandom > /etc/webapps/gitlab-shell/secret
# chown root:gitlab /etc/webapps/gitlab-shell/secret
# chmod 640 /etc/webapps/gitlab-shell/secret

# hexdump -v -n 64 -e '1/1 "%02x"' /dev/urandom > /etc/webapps/gitlab/secret
# chown root:gitlab /etc/webapps/gitlab/secret
# chmod 640 /etc/webapps/gitlab/secret

For some reason these files were empty on my installation, and the above did the trick. Also, not having enough ram for gitlab results in all kinds of interesting behavior.

Offline

#4 2016-12-01 08:30:37

yorrd
Member
Registered: 2013-07-21
Posts: 71

Re: [SOLVED] Gitlab configuration mistake, 401 Unauthorized

gmk wrote:

Not sure if still current, but maybe this will help:

For some reason these files were empty on my installation, and the above did the trick. Also, not having enough ram for gitlab results in all kinds of interesting behavior.

gmk, I'm deeply sorry for not reading the ArchWiki fully. I've committed the crime of having overlooked an important part of the Wiki.

Thanks so much, you just solved my problem smile

Offline

#5 2016-12-01 15:47:39

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,785

Re: [SOLVED] Gitlab configuration mistake, 401 Unauthorized

yorrd wrote:

Thanks so much, you just solved my problem smile

Don't forget to edit your first post to change the thread title by prepending [SOLVED]


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#6 2016-12-02 02:45:52

gmk
Member
Registered: 2015-03-08
Posts: 8

Re: [SOLVED] Gitlab configuration mistake, 401 Unauthorized

yorrd wrote:

gmk, I'm deeply sorry for not reading the ArchWiki fully. I've committed the crime of having overlooked an important part of the Wiki.

Thanks so much, you just solved my problem smile

glad to hear!

I wouldn't have known, had I not made the same "mistake" as you wink

Just added a hint on the wiki higher up, so we remain the only ones stumbling over this little detail.

Offline

Board footer

Powered by FluxBB