Git Setup Notes

Git Setup Notes

The development team is doing a test deployment of the source control system Git. The advantages of Git are that we’ll be able to maintain versions of our source code (html, c#, css) in a central location that retains history. Git also has the advantage over our old system (Subversion) in that it’s decentralized; every user of our source will have a full backup of the repository. Git also encourages experimental code branches, which was cumbersome in our old Subversion setup. While Git is a little more difficult to use than our past Subversion setup, we think its additional power will be more valuable in the long run.

Installing Git on our Server (Cancelled)

  1. Installed Git on our dedicated server on Media Temple. They have instructions here to install git as a package through the yum installer.
  2. Git is a distributed source control system. The Git commands are installed by the yum installer, but the server, git-daemon, is not installed. So, yum install git-daemon.
  3. Our (dv) 3.5 base doesn’t have any editors on it other than vi. Yuck! We ran ‘yum install joe’ to install jmacs.
  4. The git-daemon installation creates a file in /etc/xinet.d/ called git, which is set up with defaults. The repo is based in /srv/git, which is created by the installation process. To start it up, /etc/rc.d/init.d/xinetd restart. Then tail /var/log/messages to see if anything weird happened.

At this point we looked at the requirements to install Git daemon under its own username/group, and frankly we started thinking that we should look at GitHub first and get used to using Git. We’ll come back to this later.

Using the public GitHub site

GitHub is a popular open source hosting service that offers Git. Since we’re just getting used to Git, we figured we would forget setting up our own server for a while until we became comfortable with how it’s supposed to work. Here’s what we did:

  1. Created GitHub account for Agenceum.
  2. Installed msysGit on Windows Vista workstation. This tutorial was helpful. Installed TortoiseGit, but uninstalled to force myself to learn the command line first.
  3. To push to GitHub, you need to have an SSH public key. The tutorial covers the generation of this. After that, I copied my private/public key pair to a secure USB thumb drive, as I would be using it on my laptop as well.
  4. Added the public key, so I could push to the repo
  5. Followed the directions on GitHub to set up the repo, with our variations in bold:
    • mkdir Agenceum
    • cd Agenceum
    • git init
    • touch README.TXT
    • git add README.TXT
    • git add “X001 Web Page Templates”
    • git commit -m ‘first commit’
    • git remote add X-Files git@github.com:daveseah/agenceum.git
    • git push X-Files master

GitHub is now hosting our repository, which can be browsed on the web at http://github.com/daveseah/Agenceum. Our first two templates are available in the X001 directory.

Next, install Git on the laptop, and pull the files from the GitHub repository:

  1. Install Git. Choose “Unix style line endings”
  2. Create an Agenceum folder that will contain our files from the repo.
  3. Copy the .ssh folder containing my private/public keys from users/username/.ssh, so I can use the same public key on the laptop.
  4. git config –global user.email myemailaddress
  5. git config –global user.name “Dave Seah / WorkstationName”
  6. mkdir “My Git Repos”
  7. cd “My Git Repos”
  8. git clone git://github.com/daveseah/Agenceum.git – this will create the Agenceum directory for us

This copies the repository from GitHub onto the local computer. You’re done!

We will be developing a separate set of notes for the commands useful for our common workflows:

  • refreshing with the latest source
  • working on local changes
  • committing changes to the local repository
  • merging your changes back to the source repository
  • resolving conflicts
  • creating branches and tags

0 Comments