2

I'm working on an Xcode project and my brother wants to start helping out. I have the .git folder in my Xcode project directory, how can my brother pull / push / commit to / from my computer? Do I have to use OS X server and put the repo inside of there, or is there a simpler way to do this?

BuZZ-dEE
  • 3,875
  • 7
  • 48
  • 76
duxfox--
  • 8,314
  • 13
  • 50
  • 112
  • 5
    some website support private project even with free account like https://bitbucket.org/. Or you can just use ssh to share project which shall come with your OS X http://stackoverflow.com/questions/6167905/git-clone-through-ssh – owenwater Dec 21 '14 at 00:04
  • Easiest is to share the filesystems themselves, just mount them over the net. – jthill Dec 21 '14 at 01:05
  • 1
    @owenwater thanks for pointing out bitbucket, you nailed the reason why I asked this question, github private projects are paid, bitbucket is free! – duxfox-- Dec 21 '14 at 01:36

3 Answers3

3

One simple option is to enable "remote login" in sharing, which enables ssh, then you can use the ssh protocol to clone the repository. Remote login preferences will tell you:

To log in to this computer remotely, type "ssh username@computer.local".

username@computer.local will be replaced with your username and hostname. In terminal, use:

git clone username@computer.local:[path]

on your brothers computer to clone the repo to him, where [path] is the path to the folder containing the repository. You will need to enter your password, and you will need to enter it in order to copy changes back later with git push or whatever.

You can set up passwordless ssh with private keys, but bear in mind that by doing this you are effectively giving your brother entire control of your computer.

rjmunro
  • 24,825
  • 18
  • 102
  • 130
  • thank you for the detailed explanation, I'll keep it in mind for future reference, for now I just made an account on bitbucket, i was going to use github but private projects needs paid membership – duxfox-- Dec 21 '14 at 01:35
1

If you want to push code between two non-bare repositores, I recommend having a look at git-annex.

It is usually used for syncing large files between repositories, but it also contains a nifty way of syncing non-bare repositories (pushes go to synced/master branch that is automatically merged).

user1338062
  • 9,351
  • 3
  • 54
  • 56
0

Basically, if one can write a ls path or ssh [user@]host:path ls command that would list your repository, then you can use the corresponding git clone [[user@]host:]path [optionalNewName] to clone from it.

Also if he (or you) is working on the same local machine, or has access to the local filesystem, one need only point to either the .git directory or the directory containing the .git directory.

To make clone a repository into another directory:

git clone . ~/2015Archive/repositoryB     # copy pwd's repository elsewhere
git clone .git ~/2015Archive/repositoryB  # same
git clone ~path/path/repositoryA .  #  clone other repository into pwd
git clone /home/brother/2015/projects/CoolProject ~/WORK/BrosCode 
# with ssh from a remote machine 
git clone me@brosmachine:/home/brother/projects/CoolProject WORK/BrosLameCode

git clone me@brosmachine:../brother/projects/CoolProject WORK/BrosLameCode

If you change into the target repository and do a git remote -v it will show you an absolute path to the 'origin' from which it was cloned. If it was a local dir, it will be just a plain, absolute path. If it was accessed through ssh, it will be a ssh [user@]host:path identifier.

Dave X
  • 3,185
  • 1
  • 25
  • 41