'X' does not appear to be a git repository (I'm sure the path is correct)

I want to be able to work from home by cloning of the git repository that exists on my work desktop to my laptop. Both systems are running msysgit within a cygwin shell. Both systems are using cygwin’s ssh.

If I ssh to that server, I can see the repository at the path /cygdrive/d/Projects/TheProject

  • Using repo in Cygwin to download Android source
  • git pull and fetch fail with “fatal: The remote end hung up unexpectedly”
  • Uninstalling GIT on windows
  • Cygwin git fork() error on pull
  • Cannot launch git gui using cygwin on windows
  • git status different on msysgit and cygwin over the same repository
  • $ ssh TheDesktop
    MyUser@TheDesktop's password: ...I enter the password, see the MOTD, and I'm in...
    $ cd /cygdrive/d/Projects/TheProject
    ...See the git repository here.  Even see the current branch in the prompt...
    

    But I try to clone and it fails:

    $ git clone ssh://TheDesktop/cygdrive/d/Projects/TheProject
    Cloning into TheProject
    MyUser@TheDesktop's password: ...I enter the password...
    fatal: '/cygdrive/d/Projects/TheProject' does not appear to be a git repository
    fatal: The remote end hung up unexpectedly
    

    I’ve also tried symlinking the repository to my home folder:

    $ ssh TheDesktop
    MyUser@TheDesktop's password: ...I enter the password...
    $ ln -s /cygdrive/d/Projects/TheProject .
    $ exit
    
    $ git clone ssh://TheDesktop/~/TheProject
    Cloning into TheProject
    MyUser@TheDesktop's password: ...I enter the password...
    fatal: '/cygdrive/d/Projects/TheProject' does not appear to be a git repository
    fatal: The remote end hung up unexpectedly   
    

    I certainly see this error in a lot of questions here, and they almost always relate to a bad path. But I’m really certain my path is correct. I get the feeling it has something to do with the environment being ssh’d into on the desktop, but I really can’t figure out what. What other things could cause this error?

  • Recover files deleted with git rm --cached
  • Git delete branch and all corresponding changes
  • SSH Public key denied on “git clone” command
  • How can I show git commits related to a task and their merge information?
  • cannot create directory at db:migrate
  • Git Pull Windows Azure Website
  • 3 Solutions collect form web for “'X' does not appear to be a git repository (I'm sure the path is correct)”

    git clone TheDesktop:cygdrive/d/Projects/TheProject TheProject
    

    should fix it

    If the ssh server is not under cygwin, substitute the windows path:

    cygpath --mixed /cygdrive/d/Projects/TheProject
    

    It is my experience that cygwin passes the wrong path style to msysgit. Msysgit doesn’t understand /cygdrive and therefore messes it up, except with a single argument on the commandline, in which case cygwin bash appears to do the conversion magically.

    However, no such thing will be true for gitshell over cygwin sshd. I’m assuming you tried something close to

    git clone TheDesktop:D:/Projects/TheProject TheProject
    

    If that didn’t work, I’d look at

    git daemon # wasn't supported on Windows last time I checked
    

    or

    git bundle create repo.bundle --all
    
    # receive it on the remote
    scp TheDesktop:repo.bundle
    git clone repo.bundle TheProject
    

    you need to clone the repository itself, not the associated working tree:

    $ git clone ssh://TheDesktop/cygdrive/d/Projects/TheProject/.git TheProject
    

    should work

    It might have to do with that git wants to find “cygdrive/d/Projects/TheProject” relative to your login folder.

    In your first example you login via ssh and then do “cd /cygdrive/…”, which is an absolute path, not relative.

    Changing your ssh login folder to point to e.g. the Projects-folder might help you out. And also shorten your ssh path 🙂

    Git Baby is a git and github fan, let's start git clone.