I have a few Xcode projects on my iMac for which I enabled git when I created the project in Xcode. Now how can I access the repository from another Mac on my local network and make changes that are then recognized by the repository and propagated when I open the project again on the iMac?
1 Answers
If you've got remote login
enabled in System Preferences -> Sharing
, you can access your iMac from your local network via ssh
, ie ssh user@XXX.XXX.XXX.XXX
, where XXX.XXX.XXX.XXX
is your IP address.
You'd want to git clone
the repository so that you have two copies of it, one on your iMac
and one on your OtherMac
. To do that, on OtherMac
:
git clone user@XXX.XXX.XXX.XXX:/Users/<USERNAME>/path-to-XCodeProject myProject
This will create a folder "myProject" on OtherMac
, containing a clone of the git repository from iMac
. Then you'd work, git commit
as normal on OtherMac
.
The difficulty you will face with this is that the git repository on iMac
is not bare
. To get around that, you can work on specific branches, or set up an intermediate bare
repository on either Mac, which you then git push
to from OtherMac
and git pull
from from iMac
(and vice-versa).
I haven't done this; you might have issues with Mac-specific XCode project settings. I know they're by default added to the git repository.
-
Thanks, I'll try that. BTW, is that double user@user@ in your git command above correct? – koen Mar 06 '12 at 13:05
-
@Koen Nope, the double `user@user@` shouldn't be there. My bad, will edit accordingly. – simont Mar 06 '12 at 15:45
-
I ended up using DropBox to share my project between the two Macs. To keep everyting in place, I use a symlink (not an alias) to my project folders from the DropBox folder so everthing can stay in place. – koen Apr 09 '12 at 19:28