Clone Your Repository To Your Local System

Open a browser and a Git Bash window (also called a terminal window) from your desktop. The terminal window on your local system which is the system you code on as opposed to the remote Bitbucket server. After opening the terminal window, do the following:

  • Navigate to your home (~) directory.

As you work with code, you will find that you have multiple repositories that you work in. It is a good idea to create a directory to contain all those repositories. Generally, this is your home directory but it can be anywhere you want it to be.

  • Create a directory to contain your repositories.
    mkdir repos
            
    
  • If you haven't already done so, go to Bitbucket in your browser and log into your Bitbucket account.
  • Go to your bb101repo Overview page.
  • Click Clone button.
    The system displays a pop-up clone dialog. By default, the clone dialog sets the protocol to HTTPS. Leave it there.
  • Click on the command line field that accompanies the protocol.
    When you click on the command field it automatically highlights the command for you.
  • Copy the highlighted git command.

  • Switch back to your terminal window.
  • Change directory to your new repositories directory.
    cd repos
            
    
  • Paste the command you copied from Bitbucket onto the command line and press Return.

    Click to view GitBash cut 'n paste tips...


    Git will ask you for the repository password. This is the password you entered when you created your Bitbucket account. If you created an account by linking to Google or Facebook and you are following this tutorial, you should have created a password already.

  • Enter your password.
    Git creates the repository but warns you that you have cloned an empty repository. At this point, your terminal window should look something like this:
    $ cd ~/repos
    $ git clone https://newuserme@bitbucket.org/newuserme/bb101repo.git
    Cloning into 'bb101repo'...
    Password
    warning: You appear to have cloned an empty repository.
            
    

    You already knew that your repository was empty right? Recall that you have added no source files to it yet.

  • List the contents of your repos directory and you should see your bb101repo directory in it