0% found this document useful (0 votes)
82 views3 pages

Git - First Time Git Setup: Windows

Git is a version control system used for managing changes to files collaboratively. The document provides instructions for initially setting up Git, including configuring a user identity, generating an SSH key, adding the key to GitLab, getting a Git repository by cloning or initializing, and updating code. It also describes how to fix errors connecting to Git over HTTPS by downloading a root certificate and configuring Git to use it for SSL verification.

Uploaded by

Jesica Tandon
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)
82 views3 pages

Git - First Time Git Setup: Windows

Git is a version control system used for managing changes to files collaboratively. The document provides instructions for initially setting up Git, including configuring a user identity, generating an SSH key, adding the key to GitLab, getting a Git repository by cloning or initializing, and updating code. It also describes how to fix errors connecting to Git over HTTPS by downloading a root certificate and configuring Git to use it for SSL verification.

Uploaded by

Jesica Tandon
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/ 3

Git - First Time Git Setup

Overview
Getting Started
The Command Line
Installing Git
Windows
First-Time Git Setup
Your Identity
Generating a new SSH key
Add an SSH key to GitLab
Getting a Git Repository
Initializing a Repository in an Existing Directory
Cloning an Existing Repository
Updating your local code base with remote origin
Initializing a Git Repository in a Directory
Steps needed on Client configuration to fix git client Error - "SSL certificate problem: unable to get local issuer certificate"
Overview
Git is a powerful and popular system for version control. It is one of the essential tools for collaboration in software development teams. If your
project involves several or more members, you should use Git version control system for managing change and configuration on your project.

Getting Started
THE COMMAND LINE

There are a lot of different ways to use Git. There are the original command-line tools, and there are many graphical user interfaces of varying
capabilities. We will be using Git on the command line. For one, the command line is the only place you can run all Git commands. Most of the
GUIs implement only a partial subset of Git functionality for simplicity. If you know how to run the command-line version, you can probably also
figure out how to run the GUI version, while the opposite is not necessarily true. Also, while your choice of graphical client is a matter of personal
taste, all users will have the command-line tools installed and available.So we will expect you to know how to open Terminal in Mac or Command
Prompt or Powershell in Windows. If you don’t, you may need to stop and research that quickly so that you can follow us here.

INSTALLING GIT

Windows

You can download from : http://git-scm.com/download/win. This is a self installer file and does not require admin permissions. You have to do it
by yourself.

FIRST-TIME GIT SETUP

Your Identity

The first thing you should do when you install Git is to set your user name and email address. This is important because every Git commit uses
this information, and it’s immutably baked into the commits you start creating:

$ git config --global user.name "John Doe"


$ git config --global user.email [email protected]

Git uses a username to associate commits with an identity. The Git username is not the same as your GitHub username.

Generating a new SSH key

Page 1
Open Git Bash and Run following command & validate :
$ cd ~
$ ssh-keygen -t rsa -C "[email protected]"
//This creates a new ssh key, using the provided email as a label. When
you're prompted to "Enter a file in which to save the key," press Enter.
This accepts the default file location. At the prompt, type a secure
passphrase, press Enter. This accept blank password.

$ cd ~/.ssh
$ ls -la
//you should have these files in the directory: id_rsa and id_rsa.pub

Add an SSH key to GitLab

SSH keys allow you to establish a secure connection between your computer and GitLab.

Login to GitLab with your credentials.


On the upper right corner, click on your avatar and go to your Profile settings.
Navigate to the SSH keys tab.
Paste your public key(id_rsa.pub) that you generated in the above step.(Open in notepad and copy the entire content.)
Optionally, give it a descriptive title so that you can recognize it in the event you add multiple keys.
Finally, click on Add key to add it to GitLab. You will be able to see its fingerprint, its title and creation date.

Once you add a key, you cannot edit it, only remove it. In case the paste didn't work, you will have to remove the offending key
and re-add it.

You are now ready to use Git over SSH, instead of Git over HTTP !

GETTING A GIT REPOSITORY

Initializing a Repository in an Existing Directory

Cloning an Existing Repository

$ git clone <clone url>


Example :
$ git clone
[email protected]:QualityAssurance/HybridFramework.git

Updating your local code base with remote origin

$ git pull origin <branchName>


Example :
$ git pull origin master

Initializing a Git Repository in a Directory

Page 2
$ cd /c/user/my_project
$ git init
$ git add <yourfiles comma separated>
$ git commit -m 'initial project version'
$ git push origin <branchName>
Example :
$ git push origin master

If you want to connect to gitlab over HTTPS (HTTP URL instead of SSH), more configuration is required as below, this is optional and
needed only if you want to use HTTPS links for setting up local git repo etc

STEPS NEEDED ON CLIENT CONFIGURATION TO FIX GIT CLIENT ERROR - "SSL CERTIFICATE PROBLEM: UNABLE TO GET LOCAL ISSUER CERTIFICATE"

Download (attached here for reference) and store the Blackstone-Root Certificate at a local location [ Preferrably at - %userprofile% so it
remains untouched ]
Blackstone-Root.crt
Backup the current config (Just in case life wanna take you for a ride ) - cp ~/.gitconfig ~/.gitconfig_backup<date>
Edit the gitconfigure file ( if you are a console lover: vim ~/.gitconfig, else any editor will do too ) and update existing or else paste the
following content at the bottom if http and https is not already configured.

even though we wont be connecting to http, http configuration still needs to be specified to cleanly handle http urls
gitlab will force http redirection to https

Edit git config

[http]
sslCAInfo = <your-location_of_root_cert>/Blackstone-Root.crt
sslVerify = False
[https]
sslCAInfo = <your-location_of_root_cert>/Blackstone-Root.crt

Page 3

You might also like