November 2013

Gavin Pickin

Git for Dummies - Setting Up your Remote Repo on Bit Bucket

Source Control

Git is a distributed system, so you have "local" repos on you and your developers machines, and then (usually) a remote repo.
In our last walkthrough, we started by creating the "local" repo on your machine... now we need to setup the remote repo, in this example, we're going to use Bit Bucket, because you can have unlimited free private repos for individuals, and small teams, and very affordable prices for bigger teams.

So, first, we need to go to Bit Bucket, and signup an account, if you dont already have one.
Go to and filled out your User Name, Email, Password and click the button "Sign Up for Free"

You might have to prove you're not a robot, and then you'll be prompted for your Name, Location, Website, etc, you can fill that out, or Skip to the next step.

Once you are done with that, you'll be at your dashboard, and you'll be prompted to Import a Repo or Create your First Repo.

Click "Create your First Repository" and lets get going.

  • Give your a repo a meaningful name... and a description if you want to make it clear the purpose of the repo.
  • If you want to open this up to the public, you can uncheck the "This is a private repository" checkbox. If you want a public or open source repo, you can always use GitHub, but Bit Bucket is great for free Private repos, but if you want to keep your repos together, you could have your public repos here too.
  • You can select your Repo type, Git or Mercurial. Bit Bucket was initially only Mercurial, but Git is the popular Source Control system, so they added support for Git too.
  • If you want Issue Tracking and Wiki features for your repo, you can select these too, and a Language as well. Being a Coldfusion developer, its nice to be able to choose my language of choice.

As you can see, there are some helpful resources on the right hand side, Bit Bucket 101, and working in a Team... so you are only a click away from help if you need it. So far, I really like the Bit Bucket help, it has helped me as I learned the process... good documentation is always a plus when you're picking up new technologies.

Once you are done, click Create repository, then Bit Bucket continues to walk you through the process to add code to your repo.

First, you are select I'm starting from Scratch, or I have an existing project to push up.
In this case, we're going to start from scratch, our first repo we created in the last walkthrough was a simple repo from scratch, so lets walk through those steps.

As you can see, it gives you step by step instructions on how to make a directory, initialize git for that directory, and then the next step, which is new for us... adding the remote origin location. This tells our local git repo, where the remote server is, and how to communicate with it. you can copy that command (this will work on Windows in the Git Bash and at the command line on *nix systems), and run it to add to your repo.

Lets jump into the command line, and add our remote repo... and after we add them, we'll run another command to see what our changes set.

$ git remote add origin ssh://
$ git remote -v

Now, our Remote Repo is added, we can go to the next slide in Bit Bucket, and see what the next step is.
The next step is to make changes and push. We jumped the gun and did 3 of the 4 steps in the last entry, but its a nice reminder, for the next time you start a new repo.

EDIT - If this is the first time you have committed to any project on this machine, you might have to set a couple of global variables if Git cannot determine them on its own... your name, and email address... you can follow the commands you see in git, or you can go here for a simple walkthrough to add Global or Local settings for you Name and Email Address in Git.

The only step we didn't complete, was pushing our changes from our "local" repo to our "remote" repo.
Lets try that... but we'll try it without the -u origin master and see what it says

$ git push

First, you'll see that the authenticity of host can't be established. The first time you talk to a new SSH server, you have to decide if you want to trust the server or not. Type "yes" and click enter and that server will be added to the list of known_hosts in your ssh folder. You wont see this again (unless you're connecting to a new server).

Then you'll see "Permission denied (publickey)"
This is because when you communicate with Bit Bucket servers, you communicate over SSH, and the server cannot tell if this machine has permission to add to your repo or not, not without a SSH public and private key. 

To push to the remote repo, we need to setup a SSH Key... so thats next.
We're almost there... creating our first local repo was easy, the remote repo was pretty easy too, but we just have to setup a few settings...the last step is SSH keys, and we'll deal with that next. Thanks for reading, check back soon for SSH Keys.

by Scott Steinbeck
11/11/2013 02:01:52 PM

hey, I've been using svn for a while and decided i wanted to move over to git. i previously learned about bit bucket because they have private repos for free. Thanks for the quick tutorial, i was up and running pretty quickly.

Blog Search