Could not read from remote repository #3424

Closed
alfons24 opened this Issue Mar 27, 2013 · 97 comments

Comments

Projects
None yet

Hello,
i've installed GitLab 5 first time.

I get fhe following error while:

git push -u origin master
fatal: Could not read from remote repository.

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

My ssh key is working fine, when i look at
tail -f /var/log/auth.log

Mar 27 15:33:30 ugitbuntu sshd[1802]: pam_unix(sshd:session): session opened for user git by (uid=0)
Mar 27 15:33:31 ugitbuntu sshd[1935]: Received disconnect from 10.100.2.172: 11: disconnected by user
Mar 27 15:33:31 ugitbuntu sshd[1802]: pam_unix(sshd:session): session closed for user git

What happens?
What can I do?

$ gitlab-shell/bin/check
Check GitLab API access: OK
Check directories and files:
/home/git/repositories: OK
/home/git/.ssh/authorized_keys: OK

gitlab$ bundle exec rake gitlab:env:info RAILS_ENV=production

System information
System: Ubuntu 12.04
Current User: git
Using RVM: no
Ruby Version: 1.9.3p327
Gem Version: 1.8.23
Bundler Version:1.3.4
Rake Version: 10.0.3

GitLab information
Version: 5.1.0pre
Revision: a31fe1a
Directory: /home/git/gitlab
DB Adapter: postgresql
URL: https://ugitbuntu
HTTP Clone URL: https://ugitbuntu/some-project.git
SSH Clone URL: git@ugitbuntu:some-project.git
Using LDAP: no
Using Omniauth: no

GitLab Shell
Version: 1.2.0
Repositories: /home/git/repositories/
Hooks: /home/git/gitlab-shell/hooks/
Git: /usr/bin/git

gitlab$ bundle exec rake gitlab:check RAILS_ENV=production
Checking Environment ...

Git configured for git user? ... yes
Has python2? ... yes
python2 is supported version? ... yes

Checking Environment ... Finished

Checking Gitlab Shell ...

GitLab Shell version? ... OK (1.2.0)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
post-receive hook up-to-date? ... yes
post-receive hooks in repos are links: ...
stefan / blabla ... repository is empty

Checking Gitlab Shell ... Finished

Checking Sidekiq ...

Running? ... yes

Checking Sidekiq ... Finished

Checking GitLab ...

Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Init script exists? ... yes
Init script up-to-date? ... yes
Projects have satellites? ...
stefan / blabla ... can't create, repository is empty

Checking GitLab ... Finished

Now I'm testing one week ago, but I won't get it work.

Regards
Stefan

djgreg13 commented Apr 2, 2013

i have checked #3384 but no way

orfin commented Apr 2, 2013

We are having the same issue.

Gitlab RANDOMLY creates/deletes repos. From gitlab web-panel everything goes OK but sometimes the repo directories (home/git/repositories) are NOT physically created.
The same after removing project. Sometimes repository directories are NOT deleted.

root@tests:/home/git/gitlab-shell# bin/check
Check GitLab API access: OK
Check directories and files:
        /home/git/repositories: OK
        /home/git/.ssh/authorized_keys: OK
System information
System:         Debian 7.0
Current User:   root
Using RVM:      no
Ruby Version:   1.9.3p327
Gem Version:    1.8.23
Bundler Version:1.3.4
Rake Version:   10.0.3

GitLab information
Version:        5.0.0
Revision:       8b76157
Directory:      /home/git/gitlab
DB Adapter:     mysql2
URL:            http://gl.testing.com
HTTP Clone URL: http://gl.testing.com/some-project.git
SSH Clone URL:  git@gl.testing.com:some-project.git
Using LDAP:     no
Using Omniauth: no

GitLab Shell
Version:        1.1.0
Repositories:   /home/git/repositories/
Hooks:          /home/git/gitlab-shell/hooks/
Git:            /usr/bin/git

rtnpro commented Apr 3, 2013

I am also having the same issue as described above. Please help

Contributor

bbodenmiller commented Apr 3, 2013

For those having problems with repos creating/deleting try restarting sidekiq.

ArvinH commented Apr 3, 2013

I have been stuck on this issue for more than ten hours....
please somebody help!

totally same problem

''''
git push -u origin master
fatal: Could not read from remote repository.

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

rtnpro commented Apr 4, 2013

The error makes sense.
When we are trying to clone a repo from a url, say: git@localhost:sample_project.git, it says something like:

fatal: 'sample_project.git' does not appear to be a git repository
fatal: Could not read from remote repository.

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

This is because the project git does not exist there but at git@localhost:repositories/sample_project.git. Cloning from/pushing to this URL works fine.

ArvinH commented Apr 4, 2013

okay, I find out that both of we have the similarly env setting in our GitLab information:

 git@localhost:sample_project.git 

but how do we change this setting? how to change this to git@localhost:repositories/sample_project.git ?

rtnpro commented Apr 4, 2013

I am also not sure about this :\

I see only one settings parameter to configure this: repos_path which in my case is already repos_path: /home/git/repositories/.

@bbodenmiller can you help us out?

orfin commented Apr 4, 2013

OK, we have restarted:

  • Gitlab application (with sidekiq consumers)
  • Redis

and that fixed the problem. In my opinion "something" was blocking Gitlab queue (btw. implemented on Redis).

I'm almost sure that it was caused by some low-level gitlab code which wasn't aware of possibility of such situations.

Does it mean low stability of 5.0 version, the question is: Is it suitable for production environments?!
We're preparing move from Redmine to Gitlab/Github for some projects. It was a very bad sign in the first day of Gitlab tests... :((

PING to Gitlab team @ariejan @randx

ArvinH commented Apr 4, 2013

okay, I think I restart Gitlab application & redis server, but it still doesn't work..
Did I miss something?

I am having this issue too and it is very frustrating. I am not seeing anybody explain here "what" the error is saying. I read a few answers attempting to explain it, but none of those situations are my case.

I am assuming this error is actually coming from the Git command itself and not specifically from GitLab.

I, as others, followed the installation instructions exactly performing a fresh install on a new Ubuntu 12.04LTS server.

** update --
After relaxing a bit and reviewing all of my configuration files, I found my issue, which was my fault of course
Without thinking while I was configuring my server, in the /etc/hosts file I added the name x.m.com to the loopback IP address (127.0.0.1). Thus, any network calls performed on my local server to that name would go to that IP instead of the IP that NginX actually was bound to for the GitLab server.

Totally my fault, but I thought I would add this as something else for folks to double check. Make sure on the server itself that it has the hostname or IP address back to itself and specifically to the IP address the GitLab server is listening to.

ArvinH commented Apr 6, 2013

Hi,@brianhmayo
thanks for your advice, but here is my /etc/hosts


127.0.0.1       localhost
127.0.1.1         server name
# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

I don't think that I have the issue you say... but I still have the same problem

enajeeb commented Apr 7, 2013

I have similar issue. HTTP Clone URL works but SSH Clone URL does not work.

git@my.host.com:some-project.git DOES NOT WORK
git@my.host.com:~/repositories/some-project.git WORKS

Here are the environment info.
$ bundle exec rake gitlab:env:info RAILS_ENV=production

System information
System: Ubuntu 12.04
Current User: root
Using RVM: no
Ruby Version: 1.9.3p327
Gem Version: 1.8.23
Bundler Version:1.3.5
Rake Version: 10.0.3

GitLab information
Version: 5.0.1
Revision: 907a8f4
Directory: /home/git/gitlab
DB Adapter: mysql2
URL: http://my.host.com
HTTP Clone URL: http://my.host.com/some-project.git
SSH Clone URL: git@my.host.com:some-project.git
Using LDAP: no
Using Omniauth: no

GitLab Shell
Version: 1.2.0
Repositories: /home/git/repositories/
Hooks: /home/git/gitlab-shell/hooks/
Git: /usr/bin/git

enajeeb commented Apr 7, 2013

I was able to resolve my issue by changing nginx configuration to listen to *:80 instead of specific IP. Apparently due to firewall different internal and external IPs.

listen *:80 default_server;

@enajeeb It is discussed here: #3384 (comment)

I guess i'm having the same issue, but I didn't need to restart anything. I just created a project and its repo was not created. Then I removed the project and recreated. Git repo was there.
Cannot find anything useful on production.log.

Contributor

bbodenmiller commented Apr 8, 2013

Creating a project does not create the repo like it does on GitHub, atleast not as of 4.2. You must init the repo and push it up to GitLab before the repo "exists". You can vote to change this functionality at http://feedback.gitlab.com/forums/176466-general/suggestions/3797854-create-empty-repo-on-project-creation

I don't understand. I'm using release 5.0 and it creates an empty repository.

Contributor

bbodenmiller commented Apr 9, 2013

So the 5.0 release now creates empty repos? Can someone confirm?

ArvinH commented Apr 9, 2013

Or we just go back to version 4.2?
Does any one know is there any different or any thing should be notice when
install 4.2? or just follow the same installation guide?

2013/4/9 Ben Bodenmiller notifications@github.com

So the 5.0 release now creates empty repos? Can someone confirm?


Reply to this email directly or view it on GitHubhttps://github.com/gitlabhq/gitlabhq/issues/3424#issuecomment-16086972
.

成功大學 資工所 前瞻網路資料庫實驗室
資訊種子第八屆
黃首翰
Info: http://about.me/ArvinH
Email:arvin0731@gmail.com
Mobile phone:0930-955731

@bbodenmiller If you are talking about a .git folder under /home/git/repositories//, 5.0 release does create that directory when I create a new project.

jskonst commented Apr 18, 2013

Hello, i have the same issue with missing ~/repositories in path? i have centos 6.4 with installed gitlab 5.0, and projects are created automatically. But i don't know what to do with wrong url.

boxerab commented Apr 18, 2013

I am having this same problem, with 5.0 I just created a fresh install.

Then I created a test project.

There is an empty project created in the /home/git/repositories/root directory,
with url git@zebra:root/test.git.

But I get the "fatal: could not read from remote repository" message when
I try to push for the first time.

Also, I tried importing an existing bare repository, but GitLab is treating it as an empty repository,
even though it is not.

I basically have the same issue. Fresh install on Debian Squeeze and I also followed the steps given in the troubleshooting guide:

env | grep -E "^(GEM_HOME|PATH|RUBY_VERSION|MY_RUBY_HOME|GEM_PATH)=" > /var/tmp/tempenv
sudo -u git -H cp /var/tmp/tempenv /home/git/.ssh/environment

No effect yet - still: Add Remote Repository: Could not read from remote repository.: Please make sure you have the correct access rights and the repository exists.

peavers commented Apr 18, 2013

Removing my local ip from the listen tag and adding * fixed my problem.

sudo nano /etc/nginx/sites-enabled/gitlab

//BROKEN

 server {
  listen 192.168.0.7:80 default_server;         # e.g., listen 192.168.1.1:80;
  server_name git.example.com;     # e.g., server_name source.example.com;
  root /home/git/gitlab/public;

//FIXED

 server {
  listen *:80 default_server;         # e.g., listen 192.168.1.1:80;
  server_name git.example.com;     # e.g., server_name source.example.com;
  root /home/git/gitlab/public;

And then restarting gitlab and nginx

sudo  service nginx restart
sudo /etc/init.d/gitlab restart

Do you think that the nginx configuration is causing the could not read error? Seems strange to me - unfortunately I'm not using nginx though and my apache vhost is listening to *:80

I had the same error and found it came from gitlab-shell not being able to access to gitlab from the API.
Use sudo -u git -H /home/git/gitlab-shell/bin/check to verify if you have the same problem (I had an output similar to: Check GitLab API access: 403).

In my case the 403 response was caused by Nginx refusing connections from localhost.

boxerab commented Apr 22, 2013

Looks like 5.0/gitlab-shell is not quite ready for release, given so many people are having the most basic of difficulties. Or, at least, it needs better testing and documentation. I was thinking of switching from gitosis to gitlab; but I am going to hold off until things are more stable.

Contributor

bbodenmiller commented Apr 22, 2013

@boxerab things are actually quite stable and reliable... Bit if you look at the issue tracker or support forum you are going to see the worst of the worst. Biggest issues apply when you install outside of its recommended configuration. Anyone having issues should upgrade to 5.1 released today which also includes new version of gitlab shell.

boxerab commented Apr 22, 2013

@bbodenmiller thanks, I will try the 5.1 release.

boxerab commented Apr 22, 2013

I installed 5.1, and the same problem is happening. I followed the install steps: the only deviation was to modify the puma.rb config file instead of unicorn.rb (unicorn seems to have been replace by puma, but there is no mention of this in the install files.) I also had to create a tmp/sockets directory to get the service to run. I also used the 1.3 tag for gitlab-shell.

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

return OK

ssh -vT git@my.gitlab.server

returns no errors, so ssh key is fine.

boxerab commented Apr 22, 2013

Where would this type of issue be logged in gitlab?? I checked production.log, application.log and the nginx log.

boxerab commented Apr 22, 2013

it would be helpful if someone from the gitlab team did a fresh install of 5.1 and updated the install instructions;
also verify that the fresh install works.

boxerab commented Apr 22, 2013

I tried @peavers advice, and this fixed the problem.

peavers commented Apr 22, 2013

One other thing for people to try who are still having issues is to delete
the authorized_key file in ../git/.shh and then just add new key using the
gitlab interface.

I found I had three key entries in my file when I only had two in gitlab -
this caused the same errors as above. (On another clean install)

On Tue, Apr 23, 2013 at 7:40 AM, Aaron Boxer notifications@github.comwrote:

I tried @peavers https://github.com/peavers advice, and this fixed the
problem.


Reply to this email directly or view it on GitHubhttps://github.com/gitlabhq/gitlabhq/issues/3424#issuecomment-16817205
.

c7l8 commented Apr 23, 2013

I followed @peavers advice and I checked authorized_key file and I found a duplicate key. I just delete that keys and git clone over ssh work fine again.

boxerab commented Apr 24, 2013

my gitlab install was a fresh install on a new ubuntu VM, so I didn't have any issues with duplicate keys.

ArvinH commented Apr 24, 2013

All I can suggest is rolling back to 4.2 stable...
at least it works well for me.

2013/4/24 Aaron Boxer notifications@github.com

my gitlab install was a fresh install on a new ubuntu VM, so I didn't have
any issues with duplicate keys.


Reply to this email directly or view it on GitHubhttps://github.com/gitlabhq/gitlabhq/issues/3424#issuecomment-16922495
.

成功大學 資工所 前瞻網路資料庫實驗室
資訊種子第八屆
黃首翰
Info: http://about.me/ArvinH
Email:arvin0731@gmail.com
Mobile phone:0930-955731

Same issue here. Very frustrating. See #3745

Contributor

senny commented May 27, 2013

The troubleshooting guide stays in the public wiki. Everyone should have acces to make changes directly. No need to bring it into the repository.

Contributor

jdurand commented Jun 13, 2013

I lost 5 hours of my life on this issue. @shiquanwang's fix works but if you tried different solutions you ended up with a dirty ./ssh/authorized_keys file with either duplicates or legit keys assigned to the wrong user id's.
Emptying this file and re-adding my key did it for me.

I am getting below error.

git push -u origin master
Access denied.
fatal: Could not read from remote repository.

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

I have already wasted by 8 hour....could anyone please HELP!!

peavers commented Aug 8, 2013

Can you push via http?

On Thu, Aug 8, 2013 at 8:07 PM, Abhishek Kapoor notifications@github.comwrote:

I am getting below error.

git push -u origin master
Access denied.
fatal: Could not read from remote repository.

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

I have already wasted by 8 hour....could anyone please HELP!!


Reply to this email directly or view it on GitHubhttps://github.com/gitlabhq/gitlabhq/issues/3424#issuecomment-22308628
.

Nope http does not work at all....
P.S i am using nginx at the moment

On Thu, Aug 8, 2013 at 1:42 PM, Chris Turner notifications@github.comwrote:

Can you push via http?

On Thu, Aug 8, 2013 at 8:07 PM, Abhishek Kapoor notifications@github.comwrote:

I am getting below error.

git push -u origin master
Access denied.
fatal: Could not read from remote repository.

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

I have already wasted by 8 hour....could anyone please HELP!!


Reply to this email directly or view it on GitHub<
https://github.com/gitlabhq/gitlabhq/issues/3424#issuecomment-22308628>
.


Reply to this email directly or view it on GitHubhttps://github.com/gitlabhq/gitlabhq/issues/3424#issuecomment-22308852
.

Thanks and Regards
Kapoor
*
*
Twitter: @kapoorsunny

Contributor

jdurand commented Aug 8, 2013

Are there any duplicates in your ./ssh/authorized_keys file? (meaning the same key for different users)

Nope, not at all. i have only one key

On Thu, Aug 8, 2013 at 2:28 PM, Jim notifications@github.com wrote:

Are there any duplicates in your ./ssh/authorized_keys file? (meaning the
same key for different users)


Reply to this email directly or view it on GitHubhttps://github.com/gitlabhq/gitlabhq/issues/3424#issuecomment-22310860
.

Thanks and Regards
Kapoor
*
*
Twitter: @kapoorsunny

Contributor

jdurand commented Aug 8, 2013

Well... if @shiquanwang's fix doesn't work for you, I'm out of solutions. Sorry.

well, let me try the installation again.
Hope it fixes it

"crossed figure"

On Thu, Aug 8, 2013 at 2:34 PM, Jim notifications@github.com wrote:

Well... if @shiquanwang https://github.com/shiquanwang's fix doesn't
work for you, I'm out of solutions. Sorry.


Reply to this email directly or view it on GitHubhttps://github.com/gitlabhq/gitlabhq/issues/3424#issuecomment-22311162
.

Thanks and Regards
Kapoor
*
*
Twitter: @kapoorsunny

Contributor

jdurand commented Aug 8, 2013

If you try 'ssh -v' or look at the '/var/log/auth.log' file on the server. Do you get any more info on why the server hung up?

I have created a user through GUI with name "sunny" and the same user has
created the project "world".
Then created ssh key using the following command on the client login

ssh-keygen -t rsa -C "abhishek.kapoor@impetus.co.in"

then I have added key generated into the ssh keys section from GUI.

Now as per the above configuration I should ssh the git box

ssh -vt git@gitlab.impetus-n096.com

Below are the verbose logs

OpenSSH_5.9p1 Debian-5ubuntu1.1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to gitlab.impetus-n096.com [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file /home/impadmin/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/impadmin/.ssh/id_rsa-cert type -1
debug1: identity file /home/impadmin/.ssh/id_dsa type -1
debug1: identity file /home/impadmin/.ssh/id_dsa-cert type -1
debug1: identity file /home/impadmin/.ssh/id_ecdsa type -1
debug1: identity file /home/impadmin/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1
Debian-5ubuntu1.1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA
16:ef:91:1e:1c:0d:44:ca:3c:c0:c7🆎1d:4e:8f:4c
debug1: Host 'gitlab.impetus-n096.com' is known and matches the ECDSA host
key.
debug1: Found key in /home/impadmin/.ssh/known_hosts:67
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/impadmin/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to gitlab.impetus-n096.com ([127.0.0.1]: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_IN
PTY allocation request failed on channel 0
impadmin@impetus-N096:/temp/clone9/world$ cat log
impadmin@impetus-N096:
/temp/clone9/world$ ssh -vt
git@gitlab.impetus-n096.com >> log
OpenSSH_5.9p1 Debian-5ubuntu1.1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to gitlab.impetus-n096.com [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file /home/impadmin/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/impadmin/.ssh/id_rsa-cert type -1
debug1: identity file /home/impadmin/.ssh/id_dsa type -1
debug1: identity file /home/impadmin/.ssh/id_dsa-cert type -1
debug1: identity file /home/impadmin/.ssh/id_ecdsa type -1
debug1: identity file /home/impadmin/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1
Debian-5ubuntu1.1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA
16:ef:91:1e:1c:0d:44:ca:3c:c0:c7🆎1d:4e:8f:4c
debug1: Host 'gitlab.impetus-n096.com' is known and matches the ECDSA host
key.
debug1: Found key in /home/impadmin/.ssh/known_hosts:67
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/impadmin/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to gitlab.impetus-n096.com ([127.0.0.1]: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_IN
PTY allocation request failed on channel 0

After i did
git push -u origin master

Output:

Access denied.
fatal: Could not read from remote repository.

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

Below are the ls output of the git box (repositories is changed 777
intentioanally)

git@impetus-N096:~$ ls -ltr
total 20
drwxr-xr-x 16 git git 4096 Aug 6 12:36 gitlab
drwxrwxr-x 3 git git 4096 Aug 6 13:04 temp
drwxr-xr-x 4 git git 4096 Aug 7 12:26 gitlab-satellites
drwxrwsrwx 5 git git 4096 Aug 7 18:52 repositories
drwxr-xr-x 8 git git 4096 Aug 8 12:08 gitlab-shell

Below are the logs of gitlab-shell

I, [2013-08-08T12:11:06.111166 #15054] INFO -- : Removing key key-22
I, [2013-08-08T12:11:57.115998 #15092] INFO -- : Adding key key-23 =>
"ssh-rsa
AAAAB3NzaC1yc2EAAAADAQABAAABAQDCnVxgIgNHOjxYzFIxYH22jOe1EVOQHQ9Lq6slC7EVbNcxmsiHWhHCYPHmTBO0POWBslAHLBTR4gWUxpfFLNUd6rr1WfbEjwo+8tDXcvmIW1BgzvQOVL+NEEYNweEZ3WI2PRvv2QeX+QqEhnfKhlC+BUg1GUF16UKnErD9V1FoyECJQ79Jqlka/XAjK5rLaMJC8wZcT6I1fsbULJ6kwthimEhOkD7kCDOJilZg+Cbvv1mLWpdomDK3vdc+zLj3QuYOEIB+DaCSm3Ua0qRY1vnBgMQk6CzPHftisa2rEYkqcPhsJhlH9JTw8nf/+L71SqWYWCMMzrBJpBDwnhtCAHL3
abhishek.kapoor@impetus.co.in"
I, [2013-08-08T12:14:51.185698 #15332] INFO -- : Adding project
SunnyKapoor/world.git at </home/git/repositories/SunnyKapoor/world.git>.
W, [2013-08-08T12:15:27.068290 #15499] WARN -- : gitlab-shell: Access
denied for git command <git-receive-pack 'SunnyKapoor/world.git'> by user
with key key-23.
W, [2013-08-08T12:18:12.332170 #15654] WARN -- : gitlab-shell: Access
denied for git command <git-receive-pack 'SunnyKapoor/world.git'> by user
with key key-23.
W, [2013-08-08T12:23:04.954911 #16010] WARN -- : gitlab-shell: Access
denied for git command <git-receive-pack 'SunnyKapoor/world.git'> by user
with key key-23.
W, [2013-08-08T12:41:03.764366 #16291] WARN -- : gitlab-shell: Access
denied for git command <git-receive-pack 'SunnyKapoor/world.git'> by user
with key key-23.
W, [2013-08-08T12:45:29.242238 #17198] WARN -- : gitlab-shell: Access
denied for git command <git-receive-pack 'SunnyKapoor/world.git'> by user
with key key-23.

Just to add more

bundle exec rake gitlab:check RAILS_ENV=production

output:

Checking Environment ...

Git configured for git user? ... yes
Has python2? ... yes
python2 is supported version? ... yes

Checking Environment ... Finished

Checking GitLab Shell ...

GitLab Shell version >= 1.4.0 ? ... OK (1.7.0)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
post-receive hook up-to-date? ... can't check because of previous errors
post-receive hooks in repos are links: ... can't check because of previous
errors

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes

Checking Sidekiq ... Finished

Checking GitLab ...

Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Init script exists? ... yes
Init script up-to-date? ... yes
Projects have satellites? ...
sunny / world ... can't create, repository is empty
Redis version >= 2.0.0? ... yes
Your git bin path is "/usr/bin/git"
Git version >= 1.7.10 ? ... yes (1.8.3)

Checking GitLab ... Finished

On Thu, Aug 8, 2013 at 2:40 PM, Jim notifications@github.com wrote:

If you try 'ssh -v' or look at the '/var/log/auth.log' file on the server.
Do you get any more info on why the server hung up?


Reply to this email directly or view it on GitHubhttps://github.com/gitlabhq/gitlabhq/issues/3424#issuecomment-22311436
.

Thanks and Regards
Kapoor
*
*
Twitter: @kapoorsunny

DasLampe commented Aug 8, 2013

Same problem here.

One push was ok (1 commit), after this I can't do anything. No push, no clone... nothing. :(

peavers commented Aug 8, 2013

I've not got any issues with the latest 5.4 (or 6.0 for that matter) on a
clean Debian 7.0 system. The code is fine, there is something you're doing
wrong during the install. What are the results if you run the prechecks?

On Fri, Aug 9, 2013 at 8:35 AM, Andre notifications@github.com wrote:

Same problem here.

One push was ok (1 commit), after this I can't do anything. No push, no
clone... nothing. :(


Reply to this email directly or view it on GitHubhttps://github.com/gitlabhq/gitlabhq/issues/3424#issuecomment-22353460
.

DasLampe commented Aug 8, 2013

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

Checking Environment ...

Git configured for git user? ... yes
Has python2? ... yes
python2 is supported version? ... yes

Checking Environment ... Finished

Checking GitLab Shell ...

GitLab Shell version >= 1.4.0 ? ... OK (1.7.0)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
post-receive hook up-to-date? ... can't check because of previous errors
post-receive hooks in repos are links: ... can't check because of previous errors

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes

Checking Sidekiq ... Finished

Checking GitLab ...

Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Init script exists? ... no
Try fixing it:
Install the init script
For more information see:
doc/install/installation.md in section "Install Init Script"
Please fix the error above and rerun the checks.
Init script up-to-date? ... can't check because of previous errors
Projects have satellites? ...
Administrator / Test Project ... yes
[some more]
Redis version >= 2.0.0? ... yes
Your git bin path is "/usr/bin/git"
Git version >= 1.7.10 ? ... yes (1.8.3)

Checking GitLab ... Finished

#sudo -u git -H /home/git/gitlab-shell/bin/check
Check GitLab API access: OK
Check directories and files:
/home/git/repositories: OK
/home/git/.ssh/authorized_keys: OK

I hadn't edit some file between first commit and the error.
Exists more checks?
Why "post-receive hook" not run? Oo I can't see an error before.

Silly me, I missed port number in gitlab_url .
Issues is now sorted

DasLampe commented Aug 9, 2013

Oh. That's fixed it. :)

But I had pushed without error before, one time. That's crazy.

Leandros commented Aug 9, 2013

I got a similar issue, but none of the fixes here worked for me: My issue: #4751

I just went through a migration from 2.7.0 to 5.4 and finally got it working 100%. The last hurdle that I had to overcome was the notorious: "fatal: Could not read from remote repository.

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

Turns out I had to update the /home/git/.ssh/authorized_keys file and change from gitolite's shell to the gitlab-shell. Changing the shell alone didn't do the trick. You have to make sure you update the shell and key-token right after the shell (it has to correlate to the Key id in gitlab's key table).

i.e.

command="/home/git/gitlab-shell/bin/gitlab-shell key-{key.id}",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa {rest of key}

Being that I had a ton of users, I wrote this:

select concat('command="/home/git/gitlab-shell/bin/gitlab-shell key-',id,'",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ',
key) as command
from keys order by id asc

After overwriting the authorized_keys file with the output from the above query....I was in business.

Hope this helps someone.

Wojo

flakrat commented Aug 29, 2013

I had the same issue as the original poster on a new Gitlab install:

The issue turned out to be related to the rewrite rule to force SSL (port 443) and am using a self signed cert.

I needed to modify gitlab-shel/config.yml as follows, change http to https and self_signed_cert from false to true:

gitlab_url: "https://gitlab.mydomain.org/"
http_settings:
self_signed_cert: true

I had the same issue after I install gitlab 5.1.0 on ubuntu 12.04

some config files' content:
in gitlab-shell/config.yml gitlab_url: "http://my_ip/"
in nginx config: listen *:8081 default_server

(because port 80 was used by other site)

the problem was solved by change listen *:8081 to listen *:80

flakrat's solution works for me:

gitlab_url: "https://gitlab.mydomain.org/"
http_settings:
self_signed_cert: true

lygstate commented Oct 2, 2013

What's this mean:

root@ubuntu:/home/git/gitlab-shell# bin/check 
Check GitLab API access: 
/opt/bitnami/ruby/lib/ruby/1.9.1/net/http.rb:763:in `initialize': No such file or directory - getaddrinfo (Errno::ENOENT)
    from /opt/bitnami/ruby/lib/ruby/1.9.1/net/http.rb:763:in `open'
    from /opt/bitnami/ruby/lib/ruby/1.9.1/net/http.rb:763:in `block in connect'
    from /opt/bitnami/ruby/lib/ruby/1.9.1/timeout.rb:55:in `timeout'
    from /opt/bitnami/ruby/lib/ruby/1.9.1/timeout.rb:100:in `timeout'
    from /opt/bitnami/ruby/lib/ruby/1.9.1/net/http.rb:763:in `connect'
    from /opt/bitnami/ruby/lib/ruby/1.9.1/net/http.rb:756:in `do_start'
    from /opt/bitnami/ruby/lib/ruby/1.9.1/net/http.rb:745:in `start'
    from /opt/bitnami/apps/gitlab/gitlab-shell/lib/gitlab_net.rb:62:in `get'
    from /opt/bitnami/apps/gitlab/gitlab-shell/lib/gitlab_net.rb:29:in `check'
    from bin/check:11:in `<main>'

i have tried every check and solution listed in this page ten times over, and i still get the same error:
Access denied.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights

Everything gives me a correct response, every test is fine, every configuration working correctly, the http access works (clone, push, pull, etc) but i still cannot make the ssh access work

i always get this in the gitlab-shell.log

WARN -- : gitlab-shell: Access denied for git command <git-receive-pack 'myuser/myprojec.git'> by user with key key-6.

FOUND IT !!
it was the ldap bind cn password that was causing the problem !!! it is really really hard to debug problems in gitlab !!

And how to fix it?

gaui commented Dec 18, 2013

I'm getting the same issue.

$ git clone git@myserver.com:gaui/foobar.git

But I'm getting:

fatal: 'gaui/foobar.git' does not appear to be a git repository
fatal: Could not read from remote repository.

How should it be able to access gaui/foobar.git when my repo is under /home/git/repositories/foobar.git ?

If I try to add repositories/ to clone path it works:

$ git clone git@myserver.com:repositories/gaui/foobar.git
Cloning into 'foobar'...
warning: You appear to have cloned an empty repository.

gaui commented Dec 18, 2013

Got it finally to work. Although it may sound weird, the reason was the /home/git/.ssh/authorized_keys file.

I got it to work by doing:

sudo -u git -H /home/git/gitlab-shell/bin/gitlab-keys clear
sudo -u git -H bundle exec rake gitlab:shell:setup RAILS_ENV=production

Now my authorized_keys looks something like this:

# Managed by gitlab-shell
command="/home/git/gitlab-shell/bin/gitlab-shell key-1",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty [rest of key]

I had to edit nginx conf:
> sudo vi /etc/nginx/sites-enabled/gitlab

change:
client_max_body_size 5m;
to
client_max_body_size 100m;

@miko miko referenced this issue in sameersbn/docker-gitlab Feb 25, 2014

Closed

git push/pull: Access denied #26

shinvdu commented Jul 25, 2014

@jmiguel77 can you tell us how to fix it by step?

fibo99 commented Sep 3, 2014

The same problem did re-appear.
Getting mad at the impossible hope to creat enew projects (but existing ones are OK!)

(Later edit: for some reasons the new project directories were owned by root:root instead of the expected git:git. Changing that solved the problem)

@shinvdu sorry for the really late reply; the only thing that i did to fix is to put the correct password for the ldap account
In your gitlab installation go to gitlab > config folder
Open the gitlab.yml file
In the ##LDAP setting section, check the data entered (here was my mistake, the password for my ldap admin account was wrong)

DavidLemayian added a commit to DavidLemayian/documentcloud that referenced this issue Oct 26, 2014

Updated documentcloud-notes github reference
The previous method of referencing is prone to failures [1] with frequent access loss. This change is a simple and commonly used (jQuery et al) but could still fail on certain networks. If it does, `https;//` works fine.

[1]: gitlabhq/gitlabhq#3424

@DavidLemayian DavidLemayian referenced this issue in documentcloud/documentcloud Oct 26, 2014

Closed

Updated documentcloud-notes github reference #130

I had the issue with GitLab 7.0 on openSUSE 13.1. I followed and adapted the installation guide for Ubuntu (I'm familiar with both flavour of Linux, so it was an "easy" ride). But at the end and like some of you, I could clone and push via HTTPS successfully. But via SSH, I got the same error as you all did: "fatal: Could not read from remote repository."

I've found a "solution". The git user created following the installation manual has the possibility to login disabled (created via "sudo adduser --disabled-login --gecos 'GitLab' git"). This command setted for the default shell for git the /bin/false executable, which disallow login for the user. I've edited the file to set it back to bash, thus allowing local and remote login to happen (in terms of security this is really unwise). This has solved my problem: I can now clone and push using SSH as well.

My quest is not finished, I need to find a way to block remote login at least but still allowing git clone and push, via SSH. But I thought this could already help some of you.

4268146 commented Mar 23, 2016

chmod -R 777 /home/git/repositories/XXXX

this is ok

oxydron commented Apr 12, 2017

Even after the @4268146 proposal, still doesn't work.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment