0

I'm trying to set a bare remote git repository on my ovh server. When I'm trying to push, I get the following error :

fatal: '/git/repo.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.

I've tried everything so far and that include every post on stackoverflow

  • I've set a private/public key. It does not seem to be the problem. If I try with an invalid key, the message is not the same
  • I've tried pushing directly from a repository on the server and it works
  • I've tried setting chmod on the server to 777. No change
  • I've tried to change the ssh agent, the message is the same
  • this is my git configuration file

    [remote "origin"]       
    url = ssh://username@ssh.cluster014.ovh.net:/git/repo.git   
    fetch = +refs/heads/*:refs/remotes/origin/*
    puttykeyfile = D:\\Dev\\ovh-git.ppk
    

I believe this is a server configuration problem as I can push from the server on the server.

Note :

  1. on the server, the git version is 2.1.4 and my local version is 2.18.0
  2. I've already tried the following SO posts

Could you give me some input to find a way out?

Edit : This is the output of ls -ld on the repository

drwxr-xr-x+ 7 username users 10 juil.  2 08:45 git/repo.git/
larsks
  • 277,717
  • 41
  • 399
  • 399
Daniel
  • 9,312
  • 3
  • 48
  • 48
  • How (what specific commands did you run) did you create the git repository on your server? What is the output of `ls -ld /git/repo.git` on the server? – larsks Jul 02 '18 at 12:06
  • I updated the answer with the output of `ls -ld`. I created the repository with the command `git init --bare` – Daniel Jul 02 '18 at 12:18
  • 1
    The issue here is clearly path-name-related. Be aware that when you ssh in, the *apparent* root starts at the home directory of the user, rather than the actual root. If you have the home directory of `username@...` set to `/git`, for instance, the appropriate URL would be `ssh://username@host/repo.git`. – torek Jul 02 '18 at 16:14
  • Thanks @Torek, I came to the same conclusion. I tried with `/homez.166/user/git/repo.git` instead of `/git/repo.git` and it worked. Hourra! I spent 3 days on the svn migration. Thanks a lot for this last step! – Daniel Jul 02 '18 at 19:05

1 Answers1

0

If you are trying to set a git repository on an OVH server, the remote URL should be formatted like this:

url = ssh://username@ssh.cluster014.ovh.net:homez.xxx/name/git/repo.git
Pang
  • 9,564
  • 146
  • 81
  • 122
Daniel
  • 9,312
  • 3
  • 48
  • 48