GIT tutorial - Viral Website Effort
Dawei's Notes:
1. git clone my work using:
git clone git://dawei.xvm.mit.edu/socialmobility/viral.git after doing this, you will have a viral directory in your current working directory.Then, take a look at the remote directory by using git remote (your will see a remote source called "origin", which is my repository)
git remote show origin (you will see details about my repository) 2. Create your own repository: Just do: a) git clone --bare viral viral.git
b) touch viral.git/git-daemon-export-ok
c) scp -r viral.git ypod@viralcomm.media.mit.edu:/var/cache/git/ypod/
or scp -r viral.git gracewoo@viralcomm.media.mit.edu:/var/cache/git/ gracewoo/ By now, you have created a repository of your own, which others can check out or merge
work from. 3. Add your own repository as a remote repository under your current working directory a) cd viral
b) git remote add ypod "ssh://ypod@viralcomm.media.mit.edu/var/cache/git/ypod/viral.git
"
or git remote add gracewoo
"ssh://gracwoo@viralcomm.media.mit.edu/var/cache/git/gracewoo/viral.git " Note that here ypod and gracewoo are just names, you can use whatever you want, but
unless you have multiple git servers, using your name is a goo didea.
You can do git remote again to see if they have been added. 4. Now test if everything is working. Under the directory viral, just do "touch hello" a) git status (hello should be a new file)
b) git add hello (add the file hello to the tracking tree)
c) git commit -a (-a is a must, don't forget it!), type in some message
d) git push ypod master (ypod is the name you gave above, master is a global name,
referring to your work) This is very important, please read!!! 1) Always commit your work first (git add something; git commit -a) before you push or
pull. Otherwise you will screw up everything, and make the repository into a very
difficult to recover state.
2) We should all add each other's repository as a remote repository, for example, I
will do:
git remote add ypod "git://viralcomm.media.mit.edu/ypod/viral.git" You must have noticed that when we do pushing, we use "ssh", and we have to specify
the full path to the directory, but when we do pulling, we use "git", and we ignore
the ugly "/var/cache/git" part, because the git service uses that section as the base
directory. After that we can easily fetch, or pull work from each other, and we maintain our own
repositories and work independently.