Git is a version control software which will allow use to keep the files up to date and prevent the proliferation of different version. It has a number of features
- We can never “loose” a file. We can always roll things back to a previous date. (This assumes that changes are regularly checked it as described below.)
- One can edit the files on you laptop and then merge them in to the online site when one is ready for them to be seen.
- We can all work at once with out much danger of having conflicting edits.
- If we want to start an experimental branch we can. Or a branch for a future instructor to edit with out letting them change the main branch.
The basic model is that each person has there own copy of the repository. They work on it locally checking in their changes to the local repository. Then when they are ready they “push” their changes to the main repository. At any time they can update their local repository by “pulling” the changes others have made. You can have as many copies of the repository as you want. That way you can have one on your laptop, work and home machine.
Running “ssh-add” as described here will keep you from having to repeatedly enter your ssh password.
The first time you run git
The very first time you run git on a machine you need to run the commands below with “John Doe” replaced with your name and the email replaced with yours. This lets git know who you are.
% git config --global user.name "John Doe"
% git config --global user.email johndoe@example.com
You should only have to do this once on each machine.
Making a local Copy of Matheverywhere
To make a local copy you “clone” the master repository. Changing to the location where you want the local directory copy to be, one types (all on one line):
% git clone git@git.math.duke.edu:jonm/math-everywhere.git matheverywhere
This will create a copy of the math everywhere repository in a directory “matheverywhere”. To have it called something else replace the last “matheverywhere” in the above command with some other directory name.
Now what ?
Now you have a local copy of math everywhre. You can edit this all you want and not change anything on line until you are ready.
- When you are ready you should “commit” the files to you local repository. (see here for directions)
- “push” the file to the central repository (see here for directions)
- Log in to one of the math server and “pull” the update to the web server. The directions for this are given below.
Updating the version on the web server
The version that the web server uses is just a repository like any other repository. You need to “pull” the latest version to update it.
On a math department machine:
- change to the math_everywhere directory
% cd /home/system/httpd/htdocs/courses/math_everywhere
- pull the latest version
% git pull
- make sure that the permissions have been set correctly
% chmod -R ag+rX .
If you find you keep having to type in the password for your ssh key repeatedly. You should use the ssh-add command to make it so you only have to type it once per session.
% ssh-add
If you have ‘sshed’ into the math machine, you should follow the directions here to use ssh-agent.