Skip to content
Skip to content
Gooseleggs Site

Ramblings

← Basic Configuration
Setting up Configuration Manager 2012 →
-->

GIT GDS

Posted on December 7, 2012 by admin

Introduction

Git is an Open Source source-code revision system used by many open and closed sourced projects.  It superceeds SVN as the preferred software revision system as it allows greater control, easier use and is more secure.

It is the preferred tool to use for software development as it allows multiple developers to collaborate on the same project.

This document explains how to install GIT and its basic use.  Git allows many advanced features and branching, back porting and the like.

Configuration

Download the GIT software from http://git-scm.com/download/win

Step

Description

Screenshot


1         

Run the Installer

2         

At the first screen, press Next  

3         

Click Next at the license screen  

4          A

Accept or change the installation directory, and press Next  

5         

Leave as defaults and press Next  

6         

Press Next  

7         

Press Next  

8         

Select Plink and enter the path to the executable.  Click Next  

9         

Leave the line endings as is.  Press Next  

10      

 

11      

Press Finish  

 

Next Steps

SSH Key

Now that Git is installed, access to the repository on the remote server is governed by SSH keys.  Therefore, we need to generate a key and send it to have access to the required repositories.

Step

Description

Screenshot


1         

Start git Bash

2         

Type the following to generate a key (if not done this before) 

ssh-keygen –t dsa

 

3         

Press Enter to accept the default file location

4         

Press enter when prompted to enter a Passphrase (ie do not enter a passphrase)

5         

Send the id_dsa.pub file to kelvin.smith@gen-i.co.nzrequesting access to the required repository.The file is located in C:\Users\Your login name\.ssh directory.

NOTE: This directory is hidden unless you have specified to show hidden files.

Create a folder for GIT repositories

Step

Description

Screenshot

ü

1         

Create a parent folder somewhere on your hard drive that holds the hit repositories.  Something like 

C:\Git

2         

Edit the shortcut for Git-Bash and change the startup location to be the folder created in step 1

Configure Git Gui

Perform this step AFTER you have cloned the first git repository

Step

Description

Screenshot

ü

1         

Start Git-Gui

2         

Edit > Options

3         

Set the Username field

4         

Set the Email Address field

5         

Click Save

Using GIT

Git allows multiple developers to work on common source code simultaneously.  The servers function is to be a central repository for changes.  Developers clone the repository to their workstation and work on the code.  The developer then pushes their changes back to the central server.  Periodically, they pull the changes from the server to ensure that their local copy of the code contains any changes made by other developers.

To ensure that you are working on the same codebase

  1. Before starting a coding session synchronise the repository
  2. When finished a coding session, push any changes to the server

It is better to synchronise often than not.  Git is a full revision controlled system, so the tree can be reverted to previous states.  Therefore, it is better to push changes when finished a particular section of code, then wait until it is completely finished.  This way, you can revert to an earlier version of the code without having to make local backups.

To checkout a repository (starting a project)

The current GUI version cannot handle the gitolite path correctly, and therefore does not allow it to be checked out properly.  Using the command line is quick and just works.  This is only required once for each Git repository.

Step

Description

Screenshot

ü

1         

Start GIT-bash application 

2         

Ensure that the path is to your Git parent directory.  NOTE: The path is specified as a Linux path, so C: drive is /c.  In the picture shown in step 1, it is /c/Git = C:\Git.If it is incorrect, use cd to change directory (just like DOS)

3         

Type git clone ssh://gitolite@kelhome.dyndns.org/<repository> where repositoryis name of the GIT repository 

4         

If prompted if you want to continue, type yes and press enter

Usage

To update local copy from Server

From the command line

Step

Description

Screenshot

ü

1         

Start Git-Bash

2          T

Change into the required directory 

NOTE: If always using this directory, change the Working Directory of the Git-Bash shortcut to point to this location

3          T

Type git pull 

If the local copy is the same as the server, it will return “Already up-to-date”

From Git-Gui

Step

Description

Screenshot

ü

1         

Start Git-Gui

2         

Select Recent Repository (or Open Existing repository and select directory with repository)

3         

Remote > Fetch From > Origin 

When finished, click Close.

 

NOTE:  If there are changes, it will appear as to the right.

4         

Merge > Local Merge

5         

Click Merge

Syncing local folder to the Repository

This can be done through the console, though it is easier through the GUI.  Steps required are

  1. Find out what files are changed
  2. Stage the changes
  3. Put a comment about the changes
  4. Push changes to the server

Step

Description

Screenshot

ü

1         

Open GIT-Gui

2         

Press F5 or Commit > Rescan.This picture shows that there is one file change (Readme) and that two lines were deleted, and one line added

3         

Check the files if necessary

4         

Click Stage Changed

5         

Ensure than any unstaged changes are staged

6         

Enter a commit message and press Commit. 

The files will disappear from the console.

7         

Press Push to send the changes to the server

8         

Click Push
This entry was posted in GDS 3.5 Documentation. Bookmark the <a href="https://www.thesmithcave.nz/?p=36" title="Permalink to GIT GDS" rel="bookmark">permalink</a>.
← Basic Configuration
Setting up Configuration Manager 2012 →

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

© 2025 | Blog info WordPress Theme | By Bharat Kambariya