Saturday, 16 June 2012

Install git on ubuntu

This is a brief step by step guide to install git and hook up to github using ssh.

Get git
$sudo apt-get install git-core

Check the install
$which git
$git --version

Configure git
$git config --global "Firstname Lastname"
$git config --global

Set up your ssh key
$ssh-keygen -t rsa -C ""
[hit enter]
set your key password
Your identification has been saved in /home/username/.ssh/id_rsa.
Your public key has been saved in /home/username/.ssh/
The key fingerprint is:

Add the key to github
$less ~/.ssh/
Copy the key to your clipboard

Go to your github Account Settings

Click "SSH Keys" in the left sidebar
Click "Add SSH key"
Paste your key into the "Key" field
Click "Add key"
Confirm the action by entering your GitHub password

Verify the key
$ssh -T
enter the key password

You should get a success, "but GitHub does not provide shell access".

Set up a test repo
$mkdir repo-name
$cd repo-name
$git init
$touch README
$git add README
$git commit -m 'first commit'
$git remote add origin
$git push -u origin master

you'll get a 403 error

Getting past the 403 error
$vi .git/config
change https for ssh
$git push -u origin master

you'll get a Permission denied (publickey) error


$ssh-add -l shows the same fingerprint as the account settings on github
$ssh -vT comes back saying I have successfully authenticated...

Getting past the Permission denied error
$cd ~/.ssh
$vi config

User git
Port 22
IdentityFile ~/.ssh/id_rsa
TCPKeepAlive yes
IdentitiesOnly yes

$git push -u origin master

Happy days! You should now see the README file on github

1 comment:

  1. it really is my personal hornor to possess a look at at the weblog, it really is great.

    League of Legends boost

    Cheap Fifa 14 Ultimate Team Coins