1

( I have already read through this, and several other posts, thoroughly git: fatal: Could not read from remote repository )

I'm using my own server as a git server. I set it up according to several guides. Everything is fine except any operation that read or writes to the remote git repository.

Problem:

When I try to do anything that interacts with the remote server that I have set up, I get:

fatal: Could not read from remote repository.

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

in windows shell. In Cygwin it just hangs.

Quick Background:

I'm using CentOS 7 as the server and Windows 10 as the client.

On the server:

  • I made a new user 'git'

  • mkdir /home/git/myproject.git

  • git init --bare

  • opened up necessary ports 9418, 22, & 443 using:

    "firewall-cmd --permanent --add-port=22/tcp" and

    "firewall-cmd --reload"

On the client:

  • created a folder, created a text file with some text, ran 'git init', 'git add .'
  • setup rsa keys according to several guides

What Works:

I can ssh into the server fine with windows shell, cygwin and puTTy. The folder /home/git/mproject.git exists. git has been working fine locally using either windows shell or Cygwin.

Attempted solutions:

I've tried:

chmod 600 pyproject.git
chmod 700 pyproject.git
chmod 777 pyproject.git
git remote add origin git@my-site.com:/home/git/myproject.git
git remote add origin git@my-site:/home/git/myproject.git
git remote add origin ssh://git@my-site.com/home/git/myproject.git
git remote add origin ssh://git@my-site.com/repo-<wbr< a="">>/home/git/myproject.git..git
git remote add origin ssh://git@my-site.com/repo-<wbr< a="">>/home/git/myproject.git
git remote add origin git@my-site.com:/home/git/myproject.git
git clone git@my-site.com:/home/git/myproject.git
git remote add origin https://git@my-site.com/home/git/myproject.git
git clone ssh://git@my-site.com/home/git/myproject.git
git clone ssh://git@my-site.com/myproject.git
git clone https://git@my-site.com:myproject.git
git clone ssh://git@my-site.com/home/git/myproject.git
git clone git@my-site.com/home/git/myproject.git
git clone git@my-site.com:/home/git/myproject.git
git clone git@my-site.com/myproject.git

I can log into the server with ssh git@my-site.com just fine. I can also navigate to the /home/git/myproject.git folder. The ports are open. What else could be wrong?

Community
  • 1
  • 1
John
  • 775
  • 3
  • 11
  • 25
  • Are user "git" able to clone the repo locally on the server? – joran Aug 07 '15 at 20:10
  • yes. (I just tested it after you posted this) – John Aug 07 '15 at 20:15
  • Can you clone the repo locally on the server as another user with `git clone ssh://git@my-site.com/home/git/myproject.git`? – joran Aug 07 '15 at 20:32
  • yes, after being asked for 'git's password – John Aug 07 '15 at 20:38
  • This is probably far-fetched, can you clone any other remote repo using `ssh:` from your client? To rule out problems with ssh locally you can try cloning using `http:` or `git:`. – joran Aug 07 '15 at 21:51
  • Can you elaborate? I don't have any other repos set up. I can clone locally on the server. I can't clone remotely. I can do everything fine locally on either machine. It's when I try to do anything with git remotely that I have problems. I can even copy folders back and forth remotely without issue. I was thinking it was a permissions or syntax issue but I tried many different possibilities. – John Aug 07 '15 at 22:56

1 Answers1

1

So the problem seems to have been that the client and the server were using versions of git that were very different. The client was using 1.9 I believe, and the server was using 2.6. Not only that, the versions of git differed depending on the whether I was using windows terminal or Cygwin.

Now, after removing old versions and updating git, commands like:

git remote add origin git@mysite.com:/home/git/myproject.git
git push origin master

work correctly.

John
  • 775
  • 3
  • 11
  • 25