PDA

View Full Version : git with "local" remote rep




SchodMC
Aug 25, 2013, 12:32 PM
Hi guys,

Using Xcode with git seems to be a really fine solution. But there is one thing I couldn't figure out how to make it.

I want to create a remote repository on an external USB drive, so that I can push my work to the USB drive from time to time to have an external backup. So I created an new repository on my USB drive using the command "git --bare init" inside the folder where I want to store that repository. Then I switched to my projects directory and added the folder with "git remote add TestAppExternal file://Volumes/External/git\ repositories/testapp/". Everything goes fine, but when I want to push my repository to the "remote" repository on my USB drive using the command "git push -u TestAppExternal master", I got the following error message:

fatal: '/External/git repositories/testapp/' does not appear to be a git repository
fatal: Could not read from remote repository.

So - what I'm doing wrong? Will be nice if someone can help me here.

cu
SchodMC



thekingofnerds
Aug 25, 2013, 12:58 PM
Don't use file:// when you do git remote add

Remove the current remote repo and do:

git remote add TestAppExternal /Volumes/External/git\ repositories/testapp/

Just tested real quick - when you add file:// it makes it think the external HD is relative to root, rather than relative to /Volumes. Not entirely sure why - seems like it may be a bug.

SchodMC
Aug 25, 2013, 01:05 PM
Don't use file:// when you do git remote add

Remove the current remote repo and do:

git remote add TestAppExternal /Volumes/External/git\ repositories/testapp/

Just tested real quick - when you add file:// it makes it think the external HD is relative to root, rather than relative to /Volumes. Not entirely sure why - seems like it may be a bug.

Hey - that works. Even Xcode will now accept the remote repository for push / pull operations. Thank you very much.

cu
SchodMC

chown33
Aug 25, 2013, 01:25 PM
Don't use file:// when you do git remote add

Remove the current remote repo and do:

git remote add TestAppExternal /Volumes/External/git\ repositories/testapp/

Just tested real quick - when you add file:// it makes it think the external HD is relative to root, rather than relative to /Volumes. Not entirely sure why - seems like it may be a bug.

Try it with 3 slashes, e.g. file:///Volumes/External/pathname.

Or try file://localhost/Volumes/External/pathname.

The OP's error message was:
fatal: '/External/git repositories/testapp/' does not appear to be a git repository

To me, this looks like the //Volumes part is being interpreted as a hostname, which is correct according to the latest RFCs.
http://en.wikipedia.org/wiki/File_URI_scheme#Format
Note that when omitting host you do not omit the slash ("file:///foo.txt" is okay, while "file://foo.txt" is not, although some interpreters manage to handle the latter).
Also see the "Examples" section for examples.

thekingofnerds
Aug 25, 2013, 02:10 PM
To me, this looks like the //Volumes part is being interpreted as a hostname, which is correct according to the latest RFCs.
http://en.wikipedia.org/wiki/File_URI_scheme#Format
Note that when omitting host you do not omit the slash ("file:///foo.txt" is okay, while "file://foo.txt" is not, although some interpreters manage to handle the latter).
Also see the "Examples" section for examples.

That explains it. Thanks.

SchodMC
Aug 25, 2013, 05:27 PM
Try it with 3 slashes, e.g. file:///Volumes/External/pathname.

Or try file://localhost/Volumes/External/pathname.

The OP's error message was:
fatal: '/External/git repositories/testapp/' does not appear to be a git repository

To me, this looks like the //Volumes part is being interpreted as a hostname, which is correct according to the latest RFCs.
http://en.wikipedia.org/wiki/File_URI_scheme#Format
Note that when omitting host you do not omit the slash ("file:///foo.txt" is okay, while "file://foo.txt" is not, although some interpreters manage to handle the latter).
Also see the "Examples" section for examples.

Just tried it out with file:/// and file://localhost/ - both worked fine. Learned an other thing - thanks for that. ;)

cu
SchodMC