5

5Git inside Brackets

5.3

Cloning the GitHub repository with Brackets

Before we create a local copy of the GitHub repository (a clone in Git terminology § 2.9.4), we need somewhere to put it on our local machine. In my case, all the Git repositories are stored in the directory (see § 3.3):

D:\2500 Git Projects

When we use Brackets-Git to clone the repository from GitHub, we must have an empty directory to put it into. In my case I use a local directory with the same name as the GitHub repository†1. Hence I create an empty directory called lab-brackets-git within the 2500 Git Projects folder:

D:\2500 Git Projects\lab-brackets-git

†1 The directory can be any name at all, but I find it avoids confusion if I give it the same name as the GitHub repository.

The next thing we need is the SSH link for this repository. In GitHub, navigate to the repository home page (Figure 5.11), click clone or download to open the clone with dialogue box. If it doesn’t say clone with SSH, click the Use SSH link at the top right of the box (where use https is in Figure 5.12).

Figure 5.12 - GitHub—Clone a repository

Figure 5.12   GitHub—Clone a repository

Select the text that starts git@github.com... and copy it (ctrl+c), or click the paste to clipboard icon (terminal icon).

Next start Brackets. Click file → open folder and navigate to where you want to create the local repository, in my case this is:

D:\2500 Git Projects\lab-brackets-git

Now click the Brackets-Git icon (terminal icon) on the right hand sidebar, the icon will turn blue and the Git interface window will open in the bottom pane of the Brackets window (Figure 5.13):

Figure 5.13 - Git window in Brackets

Figure 5.13   Git window in Brackets

Click the clone button and in the resulting dialog box, paste in the information copied from the clone or download box in GitHub (Figure 5.14). There is no need to enter a username or password, we are using an SSH key (see § 4.3).

Figure 5.14 - Brackets-Git clone repository dialogue box

Figure 5.14   Brackets-Git clone repository dialogue box

Click ok to start the cloning process (this takes a few seconds) after which, Brackets will display the contents of the repository (Figure 5.15).

  • Brackets may ask you for your username and email address as part of this process (in my case: practicalseries-lab and lab@practicalseries.com). It depends if this is the first connection to this repository or if you have previously logged in to a different GitHub account (I discuss this further in § 8.3.1). For now just enter your username and email address if asked.
Figure 5.14 - Brackets with open Git repository

Figure 5.15   Brackets with open Git repository

The clue to this being a repository rather than just some folder is the branch icon on the left hand sidebar (Figure 5.15, highlighted in orange). This shows we are in a Git repository on the master branch.



End flourish image