Road to setup and configure Git repository.

In this post I will show you how to setup Git repository on windows machine.
Installation:
1 Download git exec file from link: click
2 Click on downloaded git exe file for installation.

3.Click on next button. And again click on next button.
4.Browse installation location in your machine and click next button.
5.Select default option in opened window and click next button.
6. Click next button
7. Select “Use git bash only” option and click next. You can choose other options.
8. Click Next button with default selected option. You can choose other options.

9.Installation completed click on “Finished” button.

Steps to create SSh Key:
1.Go to your user directory and check if .ssh directory exist.
2.Keep backup of existing keys and delete existing SSH keys in .ssh directory
3.If .ssh directory not exist, run below commend to create directory. Created new directory and>>cd .ssh
4.Run below command to generate ssh key.
$ ssh-keygen -t rsa -C user_emailid
You should see below message on git bash
Generating public/private rsa key pair.
Enter file in which to save the key (/d/Documents and Settings/user/.ssh/id_rsa ):
 Press enter button and enter password.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
 You should see message like below:
Your identification has been saved in /d/Documents and Settings/user/.ssh/id_rsa.
Your public key has been saved in /d/Documents and Settings/user/.ssh/id_rsa.pub.
The key fingerprint is:
a3:c7:e4:4d:e8:4e:cb:e7:5c:e3:70:16:d0:15:c1:0c roadtoautomation@gmail.com

 Your screen will looks like below:


Add SSH key to GitHub account:
  • Open application URL: http://github.com
  • Login into github with your valid credentials.
  • Click “Account Settings> >SSH Keys> >Add another public key”
  • Open D:\\Documents and Settings\User\.ssh\ and open id_rsa.pub file into any editor.
  • Select all and copy all text
  • Now paste it into the “Key” field.
To check everything is working now SSH to GitHub run below command
$ ssh -T git@github.com
You should see below message.
The authenticity of host 'github.com (192.30.252.129)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)?
Enter ‘yes’ you should see like below message displayed.
Warning: Permanently added 'github.com,192.30.252.129' (RSA) to the list of known hosts.
Enter passphrase for key '/d/Documents and Settings/user/.ssh/id_rsa':
Hi UserName! You've successfully authenticated, but GitHub does not provide shell access.

Setup user info:  runs below command:
$ git config --global user.name {GitUserName}
$ git config --global user.email {EmailID}

 Checkin Read me file into git repository:
$ mkdir RepositoryName
$ cd RepositoryName
$ git init
$ touch README
$ git add README
$ git commit -m 'first commit'
$ git remote add origin https://github.com/roadto11/Test.git
$ git push -u origin master
When you run last command you should see user and password option prompt on  git console, enter  git username and password one by one.  Your ReadME file committed into repository and below message displayed.
Username for 'https://github.com': roadto11
Password for 'https://roadto11@github.com':
Counting objects: 3, done.
Writing objects: 100% (3/3), 207 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/roadto11/Test.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.

Hope this will help to setup git repository

No comments:

Post a Comment

Leave your comments, queries, suggestion I will try to provide solution