I’m going to assume that you’ve already set up the SSH link between your computer and your GitHub profile (the instructions for how to do this are in § 4).
If you have, all we need is the SSH URL from the GitHub repository page (highlighted in orange in Figure 8.11). In my case it is:
Yours will be different, copy it from your account.
The SSH URL is all we need to make the link—back to Brackets.
We have to tell Brackets about the remote repository. There is a button for this on the Git pane; it looks like this it says Figure 8.12:if you hover the mouse over it. I’ve highlighted its position in Brackets in
Click it and selectfrom the dropdown (shown above). This opens the create new remote dialogue box:
This is asking for a name for the remote, call it lab-01-website. Click .
Git uses origin by default, Brackets doesn’t presume and you will always have to enter a name—hence I use the name of the repository.
Now it wants the information we copied from the new repository in GitHub.
Paste the information in and click.
This activates the remote, and buttons on the Git pane:
At this point we’ve set up the link to the remote repository, but nothing else has happened we haven’t done anything with the remote repository; we haven’t even connected to it yet. We’ve just given the connection details to Brackets.
The next thing to do is send (push) the local repository up to the remote.
Make sure you are on the master branch and click thebutton on the Git pane: .
This opens the push to remote dialogue box:
We’ve seen this screen before in section 5.4.4 with the lab-brackets-git repository. Let’s look at in a bit more detail.
The first line master branch on the remote. The is to push to this branch (this is what we want; it would be confusing to push the local master branch to a different remote branch). We also want to do a . There is no reason to do anything else.tells us it will create a new
The only thing we need to change is thetick box, tick it; we want to send our tags to the remote repository.
There is no username or password to enter, we are using SSH as the link protocol and that does not need a username and password (see § 4.3).
A couple of things happen next; first you (briefly) get a screen showing the progress of the operation:
And after this the response screen:
Well it looks ok, it says “successfully” so that’s good. It also says the master branch that have not been incorporated into our local repository.. This just means it will report if there are changes to the remote
Everything seems ok so close the dialogue box.
Now go back to GitHub and navigate to the lab-01-website repository (if you already have it open, refresh the page by pressing ). It looks a bit different.
Mine looks like Figure 8.19:
Starting on the left at the top. It says we have 8 commits. This is because we have only pushed the master branch and that only had eight commits on it (Figure 8.15). If you click the commits tab it lists all the commits on the branch:
These match the commits on the master branch workflow (exactly the same hash numbers).
Go back to the main repository screen (click the /lab-01-website at the top of the page under the black bar with the Octocat icon).
Looking at the branches tab it says there is 1 branch, this is the master branch. The local repository has two branches, but the remote repository only has one. Why?
The answer is that when we do a push from Brackets (or indeed from the Git command line) it only pushes a single branch—if no specific branch is given, it pushes the currently active branch. In our case this was the master branch; and that is why there is only one branch in the remote repository, we haven’t pushed the second branch yet.
Click the branch tab, it just shows just the single master branch.
Next is the releases tab , this lists the tags we passed to the remote repository:
These are all the tags that were entered as we created the local repository.
Finally, the contributor tab . There is only one contributor, me:
The contributor page has a lot of statistics and information in it—most of it is self-explanatory and we don’t need to go through it here.
There is one final thing, go back to the repository home page and look at the coloured bar under the tabs, Figure 8.20. It’s red and purple. Click it:
It shows a breakdown of the code within the repository 66% HTML, 34% CSS. HTML is shown in red; CSS in purple—other languages have other colours. Click the bar again to get back to the tabs.
Back to Brackets. Let’s push the d-03-contact branch up to the remote repository.
First switch to d-03-contact, click the small arrow next to the master branch and select from the dropdown. It should look something like this:
This time we have a number alongside the d-03-contact has one extra commit that needs to be pushed to the remote repository; indeed there are nine commits listed in the commit history (Figure 8.26) and we know that the remote repository only has eight commits (Figure 8.21).button , this number means that the current branch
In the push to remote dialogue box make sure theoption is ticked and click .
Again we get the successful response screen:
This time we are told the branch d-03-contact is now being tracked.
Let’s go look at in GitHub. You should have something like this:
It’s telling us that the new branch d-03-contact has been added (pushed), that’s the bit in yellow. We can also see that there are two branches.
It’s only showing eight commits though—this is because we are still on the master branch. You can see the current branch; it’s listed in the button: .
To change the active branch, click thebutton:
Select the branch you want from the list,in this case.
This gives us:
The 03-contact.html file is there and the latest commit [8329b67] is also shown (in the pale blue line about halfway down) so it looks like it’s worked.