Creating a Git Repository and Project

Tags:
Document Information
Document ID: 
app2011-018

We've been using Git to manage our Geoportal source code and the Drupal source code to the AZGS Document Repository website.  The following steps show an example of how to use Git to setup a repository, setup a project in the repository and clone the project for modifications.  Documentation on Git and what Git is can be found here.

  1. If not installed,iInstall git command line tools (http://code.google.com/p/msysgit/downloads/detail?name=PortableGit-1.7.3.1-preview20101002.7z)
  2. Open Windows/DOS command line and navigate to \\Server3\DevelopmentDocs\gitRepository
  3. Type “mkdir <project name> where <project name> = any folder name you need.  Don’t use spaces in folder name.  Press Enter
  4. Type “cd <project name”> and press Enter
  5. Type “git --bare init” and press Enter.  The “--bare” switch is important.
  6. Using the Windows/DOS command line navigate back to the directory on your workstation’s hard drive where you want to create a working copy of the new repository.
  7. Type “git clone file:////SERVER3/DevelopmentDocs/gitRepository/<project name>” where <project name> = exact same name used in step 3.  You now have a checkout version of the project with no files in it.
  8. Type “cd <project name”> and press Enter
  9. Create a text file called readme.txt.  Make sure the file is a text file by using a text editor and not MS Word, nor WordPad.
  10. Type “git add readme.txt” to add the first file to the repository.
  11. Type “git commit –a –m ‘Initial commit’ and press Enter.  The –m switch with ‘Initial commit’ leaves a message in the projects git log files.  This message can be any text you like.
  12. Type “git push origin master” and press Enter
Application Documents Description Document ID Posted by Updatesort icon Rating
Git Workflow In a recent post I described setting up a project's Git repository and cloning the project from the repository so you... app2011-019 averill.cate 01/28/2011 - 1:43pm
0