0% found this document useful (0 votes)
58 views11 pages

User Guide: A Free and Open Source Distributed Version Control System

The document provides instructions for using the Git version control system hosted at git.cse.iitkgp.ac.in. It describes how to register as a user, create projects, deploy SSH keys, and configure Linux and Windows clients to clone and commit to repositories. The user guide explains how to install Git, generate SSH keys, add existing folders to repositories, and commit and push changes from the command line.

Uploaded by

Avijit Manna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views11 pages

User Guide: A Free and Open Source Distributed Version Control System

The document provides instructions for using the Git version control system hosted at git.cse.iitkgp.ac.in. It describes how to register as a user, create projects, deploy SSH keys, and configure Linux and Windows clients to clone and commit to repositories. The user guide explains how to install Git, generate SSH keys, add existing folders to repositories, and commit and push changes from the command line.

Uploaded by

Avijit Manna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

GIT

A free and open source distributed version control system

User Guide
January, 2018

Department of Computer Science and Engineering


Indian Institute of Technology, Kharagpur
Table of Contents

What is Git Service? ...................................................................................................................................... 3


User Registration Procedure ......................................................................................................................... 3
Creating a Project.......................................................................................................................................... 3
Deploying SSH key......................................................................................................................................... 5
Configuring Linux Client ................................................................................................................................ 7
Install package git-core in the client system. ............................................................................................ 7
Open terminal and setup git global variable for one time only................................................................ 7
Locate and existing key pair ...................................................................................................................... 7
Generate a new SSH key pair .................................................................................................................... 7
Clone a project .......................................................................................................................................... 8
Add existing folder to the repository ........................................................................................................ 8
Configuring Windows Client ......................................................................................................................... 9
Install Git for Windows ............................................................................................................................. 9
Locate and existing key pair .................................................................................................................... 10
Generate a new SSH key pair .................................................................................................................. 10
Clone a project ........................................................................................................................................ 10
Add existing folder to the repository ...................................................................................................... 11

2
What is Git Service?
Git (https://git-scm.com) is the most commonly used open source distributed version
control system. Git is distributed, so the local copy is fully equivalent to the original repository
and enables users to commit offline. The service ‘git.cse.iitkgp.ac.in’ is configured to provide a
reliable git repository to the department. A web based ‘github’ like interface called ‘gitlab’ is
provided to maintain the projects more effectively.

User Registration Procedure


To use the Git service at least one user needs to be registered in git.cse.iitkgp.ac.in.
Registered users can create projects, assign systems to the project and/or add other existing
users to the project. To create a login in the Gitlab portal, please send a mail to the
[email protected] mentioning the following information.

1. Name
2. Supervisor’s Name (for non-faculty login)
3. Email Id
4. Preferred username

User will get a confirmation mail once the account is created containing the username
and password. User will have to change the password provided on the first login.

Creating a Project
To create a project, login to the git.cse.iitkgp.ac.in and click on the Create a project link
shown below.

Enter project name and description and select visibility level as shown below.
3
The following screen appears if the project is created successfully.

Change the protocol from the dropdown and select SSH. Please note the complete URL
which is required to setup the client. For example, a project test is created under the user
testuser and the repository path is shown below.

Project URL: [email protected]:testuser/test.git

4
Deploying SSH key
Open project and click on the settings button as shown below.

Click on the Repository link from the dropdown shown below.

Click on the Expand button in the Deploy keys section as shown below.

5
Copy the contents of the id_rsa.pub received from the client and paste it in the key box.
Enter a title for reference. Check Write access allowed check box if you want to allow this client
to push the changes to the repository. Click Add key button to add the key to the project
repository.

If the key is successfully added, the key appears in the Deploy keys section as shown below.

6
Configuring Linux Client
Install package git-core in the client system.
Example:
Ubuntu: sudo apt-get install git-core
Centos: yum install git-core

Open terminal and setup git global variable for one time only.

git config --global user.name "username"


git config --global user.email "email address"

Note: The user.name and user.email variable is for the user who will be using the client
system. This name and email will appear in the log of repository.

Locate and existing key pair


Open terminal and enter the following command

cat ~/.ssh/id_rsa.pub

If you see a string starting with ssh-rsa you already have an SSH key pair
and you can skip the key generate portion.

Generate a new SSH key pair

ssh-keygen -t rsa -C "email address”

Select the default options and press enter to complete the process.
Send the generated file ( ~/.ssh/id_rsa.pub ) to the project administrator assigning into the
project.

Once the key is deployed in the project and you have received the project URL, you can
now either clone the project or add existing code the project.
7
Clone a project
Change the current directory where you want to keep the project.
git clone [email protected]: testuser/test.git
cd test

Now, you can add or modify any file. To commit the changes to the repository user the
following command.

git commit -m "comment"


git push -u origin master

The above command ‘git push –u origin master’ pushes the master branch to the
project repository.

Add existing folder to the repository

cd existing_folder
git init
git remote add origin [email protected]:testuser/test.git
git add .
git commit -m "comment"
git push -u origin master

8
Configuring Windows Client

Install Git for Windows


Download the Windows setup from the link given below.

https://git-scm.com/download/win

Start the installation procedure and make sure that the following settings are checked during
installation.

9
Keep all other default options as it is and finish the installation.

Locate and existing key pair


Open command prompt and enter the following command

notepad %homepath%\.ssh\id_rsa.pub

If you see a string starting with ssh-rsa you already have an SSH key pair
and you can skip the key generate portion.

Generate a new SSH key pair


Open command prompt and enter the following command.

ssh-keygen -t rsa -C "email address”

Select the default options and press enter to complete the process.

Send the generated file (C:\Users\<username>\.ssh\id_rsa.pub ) to the project administrator


assigning into the project.

Once the key is deployed in the project and you have received the project URL, you can now
either clone the project or add existing code the project.

Clone a project
Change the current directory where you want to keep the project.
git clone [email protected]:testuser/test.git
cd test

Now, you can add or modify any file. To commit the changes to the repository user the
following command.

git commit -m "comment"


git push -u origin master

The above command ‘git push –u origin master’ pushes the master branch to the
project repository.

10
Add existing folder to the repository

cd existing_folder
git init
git remote add origin [email protected]:testuser/test.git
git add .
git commit -m "comment"
git push -u origin master

11

You might also like