Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

SchodMC

macrumors member
Original poster
Jul 29, 2013
76
12
Germany
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

macrumors regular
Jun 26, 2013
153
0
Don't use file:// when you do git remote add

Remove the current remote repo and do:

Code:
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

macrumors member
Original poster
Jul 29, 2013
76
12
Germany
Don't use file:// when you do git remote add

Remove the current remote repo and do:

Code:
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

Moderator
Staff member
Aug 9, 2009
10,751
8,423
A sea of green
Don't use file:// when you do git remote add

Remove the current remote repo and do:

Code:
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:
Code:
fatal: [COLOR="Red"]'/External/[/COLOR]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

macrumors regular
Jun 26, 2013
153
0
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

macrumors member
Original poster
Jul 29, 2013
76
12
Germany
Try it with 3 slashes, e.g. file:///Volumes/External/pathname.

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

The OP's error message was:
Code:
fatal: [COLOR="Red"]'/External/[/COLOR]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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.