The first step to using git is for one of you to set up a remote bare master repository for your shared project. Next, you and your partner clone local copies of the repo into your own private subdirectories. Finally, you each commit changes to your local copies and push and pull changes to and from the remote master to share work.
git config --global user.email "username@cs.swarthmore.edu" git config --global user.name "Your Name"Replace the email and name strings with your email address and name. If you have not run these commands, then the very first git commit will fail and tell you to run them.
You can also configure your default editor for commit messages (set to vim, or emacs or ...):
git config --global core.editor "vim"
$ gcreate.sh repo_nameThis will set up a new git bare repository in ~/share/repo_name/ with permissions and acls set correctly.
Here is an example run (what I'm typing is shown in bold):
$ gitcreate.sh cs75_lab2 Initialized empty git repository in /home/newhall/share/cs75_lab2/ Enter a space separated list of users: newhall knerr These commands will be entered setfacl -R -d -m user:newhall:rwX,user:knerr:rwX,user:newhall:rwX /home/newhall/share/cs75_lab2 setfacl -R -m user:newhall:rwX,user:knerr:rwX,user:newhall:rwX /home/newhall/share/cs75_lab2 Should I do this? (Y/n)Y acls are set up Repository creation successful Central repository located in /home/newhall/share/cs75_lab2 Run git clone /home/newhall/share/cs75_lab2 to get a local copy of the repository
Here is an example where I'm creating a new git bare repository in ~newhall/shared/cs75_lab2 (note that I'm setting permissions on my shared subdirectory so that anyone can cd into it):
# (1) create the directory for the new repository $ cd $ mkdir share $ chmod 755 share $ cd share $ mkdir cs75_lab2 $ cd cs75_lab2 # (2) run git init inside that directory: $ git init --bare
# you can run easyfacl from anywhere, but I find running it from up # a directory makes entering the path name easier $ cd .. $ easyfacl Enter a space separated list of users: newhall knerr Enter a pathname (relative or full): cs75_lab2 ...note: any time you add a new git repository, you need to run easyfacl to re-set acls on it.
At this point, you now have a master git repository for your project that only you and your partners can access. All changes, additions, deletions, to this project can be done with git commands that will push and pull changes from this remote master copy.
$ cd ~/private $ mkdir cs75 $ cd cs75 $ git clone ~newhall/share/cs75_lab2 $ cd cs75_lab2 $ ls # FYI: you can look at the git config file to see where # the remote master repository is (to where pull and push go) $ cat cs75_lab2/.git/config