Beanstalk Guides

Working with Git on Linux

Table of Contents

Installing and configuring Git on Linux is a very straightforward process as Git was natively developed for the Linux platform. This guide will walk you through the steps to install and configure Git to begin developing using the Git version control system.

Installing Git

Git can be installed using automated package management utilities such as apt or yum, alternatively Git can also be compiled from source code.

Source Code

Download the latest Git source package. Once downloaded open up your terminal and change into the directory where it was downloaded, then execute these commands.

# Extract the code:
tar -xzvf git-* && cd git-*
# Configure the source code for compilation:
# Build and install:
make && make install

Package Manager

Execute the following commands to install Git, based on your distribution (as root or using sudo).

# Debian/Ubuntu:
apt-get install git-core
# Red Hat/Fedora:
yum install git

Note: Depending on your release of Red Hat / Fedora, Git may not be available in the primary repository. If installing does not succeed, use the EPEL repository.

Creating SSH Keys

In terminal execute the following commands in order to generate a key pair.

# Change into home directory:
cd ~
# Generate a key pair:
ssh-keygen -t rsa

After entering ssh-keygen you will be prompted for the location of the key pair, the default location (/home/$(whoami)/.ssh/ is sufficient. You will also be prompted for an optional pass phrase that will be required each time the key is used, while optional, it is highly recommended to setup a strong pass phrase for the key.

# Concatenate the key:
cat ~/.ssh/

Now copy the key to your clipboard, your key should look like the following:

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAyyA8wePstPC69PeuHFtOwyTecByonsHFAjHbVnZ+h0dpomvLZxUtbknNj3+
Mac Pro

In your Beanstalk account, the added SSH key will look like this:

SSH Key Details in Beanstalk

Checking your connection

Before trying to access your Git remote repository, check if the connection to your remote hosted Git repository works. Enter the following command in the Terminal, replacing accountname with your account name:


In this case, this is the URL to access Git on your Beanstalk account. If you are using another version control hosting service, the URL would be provided by them.

You’ll most likely encounter a message that looks like this:

The authenticity of host ' (' can't be
established. RSA key fingerprint is 30:9a:97:f3:19:4f:d1:6e:28:76:9e:e7:d1:df:2c:31.
Are you sure you want to continue connecting (yes/no)?

You can type yes and press Enter, which will add your account’s hostname to a KNOWN_HOSTS file. This step won’t need to be repeated unless your public key or your account names changes. Also, this must be done from the Terminal.

If you were authenticated correctly, you will see a message similar to this one:

You were successfully authenticated as [emailaddress] in
You can now continue to configure your local Git profile.

Setting up your Git Profile

After you have authenticated correctly by installing Git and setting up SSH keys, before you start using your Git repositories, you should setup your Git profile by typing following after you run Git bash in command line:

git config --global "Firstname Lastname"
git config --global ""

In case you are using Beanstalk for version control, it would be best if your first name, last name and email address match to the ones you use in your account to avoid any conflicts.

Repository Configuration

The easiest method to create a local repository is to clone the remote. This can be accomplished by performing the following through terminal.

git clone

You should now have a repository directory named after your repository name. Now you can begin developing with using Git.

Linux GUI Client

Multiple Linux GUI based Git clients are available, your mileage may vary and using terminal is the preferred method.