Related Entries

SVN client over SSH to remote Unix server from Windows
Quick Start Grinder - Part V
Quick Start Grinder - Part IV
Quick Start Grinder - Part III
Quick Start Grinder - Part II

« Quick script to maintain a diary
» Git with Dropbox

Quick Start: Git for personal use

Manual is too damn long for Git. If you've this problem, here is a quick recipe.

Problem: Needed to find a way to keep my config and research files under version control which I can get to various machines I work with and update from anywhere.

Tried Mercurial, Darcs, Bazaar and Git. Fossil is also a great tool that provides wiki, version control and ticket management. Darcs is the easiest, but for some reason, extremely slow. Finally chose Git. Download and compile was easy. Read top 3 lines in the INSTALL file in source distribution for steps. Rest of the steps explain how I set it up. Note that this may not be the best possible Git workflow. Merely that it works for me. Note that I’ve installed git in ~/software/git.

Step 1: Setup a repository in my host

mkdir -p ~/repos/project_sample.git
cd ~/repos/project_sample.git
git init --bare

Step 2: Clone the repositor to my client PC

mkdir -p ~/workarea/
git clone --upload-pack /home/myusername/software/git/git-upload-pack ssh://myusername@myhost/~/repos/project_sample.git
cd project_sample
git remote add dev ssh://myusername@myhost/~/repos/project_sample.git
#now edit .git/config to add the following two lines under the section [remote "dev"] without the first # sign
#uploadpack = home/myusername/software/git/git-upload-pack
#receivepack = home/myusername/software/git/git-receive-pack

#let us add a file and push it up
echo "This is a sample file" > sample.txt
git add .
git commit -m "initial commit"
git push dev master

#it is a good idea before you update any file, just pull the latest from the remote server
git pull dev master

That’s it. You can go to the server directory and run git log to see if your push has reached there. Now on, before you plan to edit anything, just do a git pull dev master to get the latest from remote, do all your changes, then do a git add ., git commit and when you are ready to push all changes up, do a git push dev master.

For Windows workstations, MSysGitPortable with Putty (Plink and Pageant) works very well. For Linux, it is easy. Either download as binary and install or compile source.