Git bare repository on shared network drive

If you are working on Windows operation system and try to connect to bare git repository located on network drive, you can possible get the following error:

ashapovalov@MW100604 /c/tfs/Develop (master)
$ git push -u origin master
fatal: '\mw100604\resonate.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.

So, let's start for the beginning. I have a bare git repository located there:

\\mw100604\resonate.git

It is a network drive, so in the beginning of path I have \\ In my source code folder I initialized git

ashapovalov@MW100604 /c/tfs/Develop (master)
$ git init
Initialized empty Git repository in c:/tfs/Develop/.git/

and add network path to git bare repository

ashapovalov@MW100604 /c/tfs/Develop (master)
$ git remote add origin '\\mw100604\resonate.git'

But when I try to push I got an error message which I showed in the beginnig of the post. The reason is simple: double slash are replaced to single in git, which probably is easy to spot for unix developer, but not for Windows developer :) To fix it just change back slash to slash

$ git remote add origin '//mw100604/resonate.git'

Now you will be able to successfuly push your changes to git bare repository.



Comments

Social media

Search

Latest Tweets