Monday, 22 October 2012

Git - Getting started



1. Backup any existing ssh keys
     $ cd ~/.ssh/
     $ mkdir key_backup
     $ mv *.pub ./key_backup/

2. Generate private ssh keys
     $ ssh-keygen -t rsa -C "developer.rps@gmail.com"
     $ Enter file in which to save the key: filename
     $ Enter passphrase : *****

3. Add private ssh key to git.gitorious.org account
     $ sudo apt-get install xclip
     $ xclip -sel clip < ~/.ssh/filename.pub
   



       - go to account setting in the user page of git.gitorious.org     
       - Go to your Account Settings
       - Click ssh keys
       - Click "Add SSH key"
       - Paste your key into keyfield
       - Click Add key


4. Check whether ssh key is successfully added
     $  ssh -v git@gitorious.org


5. Clone the remote repo
     $ mkdir ~/workspace/
     $ cd ~/workspace
     $ git clone git://gitorious.org/project_name/repo_name

6. Adding files to remote repo
     $ cd ~/workspace/athena
     $ nano someFile.txt

7. Add some msg to it, save and exit
     $ git add someFile.txt
     $ git status
     $ git commit -a
     $ git remote set-url --push origin git@gitorious.org:athena/athena.git
     $ git push origin master #only for the first time,
     $ #next time onwards just use "git push")

   If the step 7 throws an error like this,
          $ Permission denied(publickey).fatal:The remote end hung up unexpectedly

  do the following, then try pushing
     $ ssh-add ~/.ssh/id_rsa.pub
     $ git push

8. Getting files from remote repo
     $ git pull

0 comments:

Post a Comment

தங்களது கருத்துக்களை இங்கே வெளியிடவும்...

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More