Wednesday, 7 May 2014

SETUP GITHUB IN UBUNTU


Setup Github in Ubuntu

  It is a new hosted Git repository service that's being called a "social network" for programmers. It is basically a distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Step1 : You have to create your account at github and now you want to work with it from your terminal.
Step2 : (Setting up ssh keys)
Before you start installing Github, you should set up ssh keys:
 $cd ~/.ssh
If it says "bash: cd: ./.ssh:No such file or directory",it means its not generated and you should continue with step 3. But if it changes to ~/.ssh directory, continue from step 4. 
Step3 : open your terminal and type PRE.ctl { font-family: "Lohit Hindi",monospace; }P { margin-bottom: 0.21cm; }A:link  
   $ssh-keygen -t rsa -C "your_email@youremail.com"
You will get following lines: 'Generating public/private rsa key pair. Enter file in which to save the key(/Home/ubuntu/.ssh/id_rsa):' just press enter now it will ask you to enter passphrase note that passphrase you enter must be >4, otherwise you will have to repeat whole process again.
Ex:I enter here my name...saritha
Step4 : open the file id_rsa.pub from ~/.ssh/id_rsa.pub and copy whole content of that file.(or)
you can open that file from terminal by using command as
$gedit id_rsa.pub
copy whole data...(or)
copy it to the clipboard by usinning fallowing commands:$sudo apt-get install xclip
$xclip -sel clip < ~/.ssh/id_rsa.pub
Step5 : After copy of entire content. Open github site and login. go to “Account Settings” > Click “SSH Public Keys” > Click “Add another public key” paste it  into "key field" and title enter any title name. then press Add key.
Ex: Here I entered title name as SSH FOR UBUNTU.
Step6:
And now try to connect to github to see if everything is working:
$ssh-add ~/.ssh/id_rsa (here need to press enter)
$ssh git@github.com

It will ask per passwrd need to  type your password ( for the first time).
Step7:   (To configure git)
Now you have successfully setup ssh key and ready to install github in terminal.
to download a local copy of your code branch. You'll need to replace "username" with your GitHub user name and project name with the name of project on github.
Setup git with your name and email address
$git config --global user.name "Name Last Name"
$git config --global user.email "your_email@youremail.com"
$git config --global github.user your_username







*************HAPPY READING :-)******************





No comments:

Post a Comment