Install git by typing
sudo apt-get install git
Then lets install Heroku toolbelt by typing this in
wget -qO- https://toolbelt.heroku.com/install.sh | sh
Both git and heroku use SSH keys. I always backup my SSH keys by backing up my “.ssh” folder in my home directory. You can then copy this folder back to any new Ubuntu installation you have and you won’t have to regenerate your SSH keys! Win! If you need to generate a new SSH key then just follow the instructions here: https://help.ubuntu.com/community/SSH/OpenSSH/Keys#Generating_RSA_Keys and you should be good to go.
As an additional optional I like to configure my username and email in git. Follow the steps in the two listed links below and your git will be setup right.
You now have SSH keys which GIT and HEROKU will use plus you have setup your git config which will also benefit both these programs.