1

This seems like it should be simple but I just can't get this to work and I have searched everywhere but I can't seem to find an answer using a fileshare. I am getting an error when I push a local repository to a fileshare on a network drive. Here is what I have done:

//Create The repository:
cd H:/
git init --bare --shared=group test.git
//Have also tried git init --bare test.git

Then I create a local repository:

cd MyDocuments/Test
git init
git add .
git commit -m "Initial Commit"
git remote add origin 'H:/test.git"
//Have also tried (among many others):
git remote add origin 'file:///fileshare/test.git'

I then get this error:

$git push origin master
fatal: '\fileshare\test.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.

What am I doing wrong here? Thanks in advance.

denin
  • 13
  • 1
  • 4
  • Did you tried without the quotes? `git remote add origin H:/test.git` – VonC Nov 05 '14 at 09:53
  • This worked! But, the reason I had the quotes in the first place is my actual project has a space in the path name which, of course, doesn't add the repository as a remote and just gives me a usage error. How can I add the repository that has a space in the path? – denin Nov 05 '14 at 15:24
  • I propose in the answer below a few alternatives to deal with space. – VonC Nov 05 '14 at 15:28
  • Update: I have found that double quotes (") and using the backslash escape character before a space work, but a single quote does not. Anyway, thanks a TON VonC, getting it to work in the first place got me going, I appreciate it! – denin Nov 05 '14 at 15:34
  • Is it like the one I mention below (with a `<===`)? – VonC Nov 05 '14 at 15:36
  • Yes, except I didn't need the '\' when enclosed in double quotes. – denin Nov 05 '14 at 15:39

1 Answers1

0

As I commented, this would work:

git remote add origin H:/test.git

For path with spaces, you can try various escape schemes:

git remote add origin H:/path_with\ spaces/test.git
git remote add origin "H:/path_with spaces/test.git" <===
git remote add origin H:/path_with^ spaces/test.git

Or use the same solution as in "GIT clone repo across local file system":

git remote add origin file://"H:/path_with spaces/test.git"
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250