Search code examples
gitftposx-mountain-lion

Git init on a virtual volume


I mounted a (FTP) folder via Transmit on my mac as a volume. It's fully accessible and I'm able to walk through the directories with the terminal app.

But I can't call git init without the getting the error message:

/Volumes/FTPVolume/doc/.git: No such file or directory

The .git folder should be created through this call, so the error message doesn't make much sense to me. I can setup a git repository on my local volumes with this call.

When I try to connect the folder to git anyway through for example

git remote add origin https://username@bitbucket.org/repositoryowner/project.git

then I get the error message

Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

Is the one problem connected to the other? And more import, is it possible to initialize a git repository on a virtual volume?

I'm working on a Mac Mountain Lion and creating the volume trough the app Transmit.


Solution

  • The symptoms you describe suggest that you either don't have write access to the FTP mount, or the mount does not support the filesystem hooks that git uses to manage files / directories. The second error, although it sounds cryptic, just means that the "git remote" command also could not find a .git folder. The specific error is caused because when git doesn't find it in the current directory it will traverse upwards and check all parent directories until a filesystem boundary is found. So that should help you understand the errors.

    To help you get to where I think you're trying to go with this: I'm going to guess that what you really want to do is to get the code that is on the FTP server into your remote repository via git push. To do that, try the following starting from your home directory or someplace other than the mounted FTP volume:

    mkdir my_ftp_project
    cd my_ftp_project
    git init
    git remote add origin https://username@bitbucket.org/repositoryowner/project.git
    export GIT_DIR=`pwd`/.git/
    cd /Volumes/FTPVolume/doc/
    git add .
    git commit -m "Initial commit"
    git push
    

    The key here is to use the "GIT_DIR" environment variable to point git to a working repository. Instead of trying to create the git repository on the ftp server (which I think is a bad idea anyways), the above will create the repository on your HD in your home folder, and then just point git back to that repository instead of having it try to create a new one on the ftp.

    Note that you should "unset GIT_DIR" after you're done in case you need to use git normally elsewhere in the same shell. Also, be sure to set GIT_DIR again when you come back and want to run more git commands on the ftp mount against this repository.