Home Blog Feed

Project Athena: Git and Gitorious.org

Backup any existing ssh keys

$ cd ~/.ssh/
$ mkdir key_backup
$ mv *.pub ./key_backup/

Generate private ssh keys

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

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

Check whether ssh key is successfully added

$  ssh -v git@gitorious.org

Clone the remote repo

$ mkdir ~/workspace/
$ cd ~/workspace
$ git clone git://gitorious.org/athena/athena

Create remote repo from existing local repo

$ mkdir ~/workspace/
$ cd ~/workspace
$ # add files if not already exist
$ git init
$ git remote add origin git@gitorious.org:athena/athena
$ git commit * -m "some message"
$ git push origin master

Adding files to remote repo

$ cd ~/workspace/athena
$ nano someFile.txt

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

Getting files from remote repo

$ git pull

Start a new branch

$ git branch feature-A
$ git branch -a

Select new branch

$ git checkout feature-A

Push commits on new branch to remote repo

$ git push origin feature-A

Merge new branch with master

$ git checkout master
$ git merge feature-A

Delete a local branch

$ git branch -D feature-A

Delete a remote branch

$ git push origin --delete feature-A