Setup SSH

Follow the steps in this post on bitbucket.org

https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/

There is also a script in there to configure your bash shell to automatically start the agent when launch the shell.

Local: go to .ssh directory

ssh-keygen

Name your key and give a password

Add the key to the ssh-agent:

ssh-add ~/.ssh/id_rsa # or whatever the name of the key is

tip: create an alias sshaddxx

How to add the public key to bitbucket:

  • From Bitbucket, choose Personal settings from your avatar in the lower left.

  • https://bitbucket.org/account/settings/
  • Click SSH keys.
    If you’ve already added keys, you’ll see them on this page.

  • In your terminal window, copy the contents of your public key file. If you renamed the key, replace id_rsa.pub with the public key file name.

    On Linux, you can cat the contents:

    $ cat ~/.ssh/id_rsa.pub

  • Select and copy the key output in the clipboard.
    If you have problems with copy and paste, you can open the file directly with Notepad. Select the contents of the file (just avoid selecting the end-of-file characters).

  • From Bitbucket, click Add key.

  • Enter a Label for your new key, for example, Default public key.

  • Paste the copied public key into the SSH Key field.
    You may see an email address on the last line when you paste. It doesn’t matter whether or not you include the email address in the Key.

  • Click Save.
    Bitbucket sends you an email to confirm the addition of the key.

  • Return to the terminal window and verify your configuration and username by entering the following command:

    $ ssh -T git@bitbucket.org

    The command message tells you which of your Bitbucket accounts can log in with that key.

  1. conq: logged in as emmap1.
    You can use git or hg to connect to Bitbucket. Shell access is disabled.

    If you get an error message with Permission denied (publickey), check the Troubleshoot SSH issues page for help.

Now that you’ve got an SSH key set up, use the SSH URL the next time you clone a repository. If you already have a repository that you cloned over HTTPS, change the remote URL for your repository to use its SSH URL.

Edit an SSH key

After you add a key, you can edit the key’s Label but not the key itself. To change the key’s contents, you need to delete and re-add the key.

How to add public keys to the server: Read More

A web-focused Git workflow

  • Follow the steps in this post from Joe Maller
    http://joemaller.com/990/a-web-focused-git-workflow/Some key advantages of this setup:
    – Pushing remote changes automatically updates the live site
    – Server-based site edits won’t break history
    – Simple, no special commit rules or requirements
    – Works with existing sites, no need to redeploy or move files
  • Don’t forget to make the hooks executable (chmod +x) !!
  • A similar approach (but without a hook to pull changes on live website, I believe) is found here: http://mattbanks.me/wordpress-deployments-with-git/