Setting up

sudo apt-get install git

Configuring the username

git config --global user.name "FIRST_NAME LAST_NAME"

Specifying the email

git config --global user.email "MY_NAME@example.com"

Generating an ssh key

ssh-keygen

Press enter for all prompts

Starting the ssh agent

eval `ssh-agent -s`

And checking that it has started

ps -e | grep [s]sh-agent

You should see something like this

Adding the key to the ssh-agent

ssh-add /root/.ssh/id_rsa
  1. Open the website bitbucket.org in your browser
  2. Log in, if you are not registered, then register
  3. Click on the icon in the lower right corner, and select Bitbucket settings from the dropdown menu
  4. In the opened menu, select "SSH keys" and click add
  5. In the terminal, execute
    cat ~/.ssh/id_rsa.pub
  6. Copy the result of the command and paste it into the window in the browser.
  7. Click add key
  8. Then return to the console and output the contents of the key with the command
    cat /root/.ssh/id_rsa.pub
  9. Copy the obtained key into the browser
  10. Click add

That's all, just clone your project from Bitbucket, for this you need to go to the directory where your site should be located, and execute in the terminal :

git clone git@bitbucket.org:Your_login/your_repo.git
git commit -m 'test'

git push origin master uploads to the server

git pull retrieves from the server.

A version for centos will be available soon

For more details on how to work with git, visit the sites: githowto.com and git-scm.com