Lessons: 21Length: 2.6 hours

Next lesson playing in 5 seconds

Cancel
  • Overview
  • Transcript

4.1 Setting Up GitHub

GitHub is just one example of a hosted Git service, but it’s easily the most well-known and popular one. In this lesson we’ll get an account set up ready for us to use.

Related Links

4.1 Setting Up GitHub

Hello, folks. In this lesson, we're gonna take a quick look at Github. Let's just open it up in a browser. So GitHub is a service for hosting remote repositories. A remote repository is simply a copy of our project that is not hosted on our own computer. The idea of GitHub is that it's a server that we can host our repositories on and connect to over the internet in order to pull code from or push code to. Other developers can also download code from the remote repository in order to share our code. So let's set up an account. We need to choose a username, so I'm just going to call myself dan-test, and I'm gonna specify an email address. And it, it needs to be an email address that isn't associated with another GitHub account. So I'm gonna use one of my test accounts for Outlook. [BLANK_AUDIO] And then we need to choose a password. Okay, so then we can click the Sign up for GitHub button here. And once we've done that, we get to this welcome page here that says You've taken your first step into a larger world. Below that, it gives a number of different plans that we can choose. As you can see, there are a number of different paid plans that we can choose from. And these give us different numbers of private repositories. We're gonna take the free plan, and that's been preselected for us. And you can see that even with the free plan, we get an unlimited number of collaborators and an unlimited number of public repositories. So, that's the difference, really, between the paid plans and the free plan. With a free plan, everything you do is public, so anyone can look at your repositories. They can look at your commits. They can see everything and all of your files. With the paid plans, you get private repositories that other people just can't come along and take a look at. So the free account should be more than enough for working on open source or free software. Whereas if we're working for a company or we're creating closed source code that we're gonna sell, we probably don't want people just to be able to go in and take whatever code they want because we're going to sell it. And in that case, we would choose a paid plan. But in this case, we are just gonna go with the free one, so it's fine. So let's now scroll down and we see this Finish sign up button here at the bottom. We're just gonna click on that. So this now takes us to our kind of Git home page. And we have this great big banner at the top, which says that we can learn Git and GitHub without writing any code. That's kind of what we're doing now, so I'm just gonna close that down. So when we log in to GitHub in future, this is the page that we'll see first of all. So we have our news feed on the left here, and it's empty at the moment. But there are some useful links, so we can create a new repository. We can update our profile. We can look at some other interesting repositories. And by interesting, it means other repositories which have got a lot of people following it. And we can also follow GitHub on Twitter. We are not going to do any of those things right now. But on the right-hand side, you can see that there is a box which lists our repositories. And it gives us a great big green button that we can use to create a new repository. So let's do that now. Let's hit that big green button. And now that takes us into a new page where we have to set up the name of our repository. So the repository that we've been working with throughout this course so far is called Project. So let's just call this repository Project as well. And then later on, we can import our local repository to GitHub. So that's fine. It's given us a tick. That means it's a valid name for a repository. And if we can't think of a name, underneath you'll see that Git has given us a suggestion called spawn camping-dubstep, which is quite an interesting name. And if we refresh the page, or every time we come back to this page, Git will give us a different example repository name there. And that's, that's quite fun and interesting. So below this, we can add a description if we want. So let's just add a brief description here. [BLANK_AUDIO] And below this, you can see that the public repository radio button has been preselected. We can't actually choose the private one because we're on a free plan. But if we had a paid plan, we would have the option of creating a private repository if we wanted to. And then below this, we have quite an interesting section with a check box that says, Initialize this repository with a README. Now when we do this, it means that we can clone the repository to our local computer and start working on it straightaway without doing any other setup. We're not gonna take that this time because, as you remember, we already have the repository locally and it already has a README. And we can also choose to add a gitignore with some pre-ignored files. Depending on which projects we're working in, we can choose one of those. And we can even add a license file if we want. And if we open up that box there, it will give us a list of different licenses that we could have. So we're not gonna do any of those things. We're just gonna come down and click this Create repository button at the bottom. So now the repository is created, and you can see that it has a unique URL at the top of the page. It's under my test account, dan-test, and the name of the repository is project. So we can access this repository using this simple URL. And on the page here, it's got some setup instructions of things that we might want to do next. So this page will stay here, and it will accessible until we've done at least one of the things listed here, so don't worry about losing this vital information. We'll be coming back to this page shortly. For now, let's just take a look at a couple more cool features of GitHub. So one such feature is called Gist. And this lets us create small snippets of code called Gists, which we can easily share with other people. Of course, if our repositories are public, then any code we write can easily be shared with others. I mean that's kind of the point of GitHub after all. But if our repositories are really massive and have hundreds or thousands of files in, and we say to somebody, oh, just go and copy that bit of code from that file. You know, it's not quite as clear as giving someone a URL and saying, this is everything that you need. So let's just create a gist now so you can see how easy that simple task is. And up in the toolbar right at the top of the page here, there's s link that says Gist. Let's just click on that. So this takes us to gist.github.com. This is actually completely separate from our accounts and the repository that we just created. So we are still signed in with our account name. That's fine. But this file that we create now, it won't be associated in our main GitHub account, so just something to be aware of there. So when we want to create a new gist, we can give the gist a description. Let's just call this one JavaScript boilerplate. And then the actual code that makes up the gist is added in the big text area below this. And we can give the file a name. Let's just call it boiler. And let's change the language, and we've got a whole range of different languages that we can choose here. And it's gonna be a JavaScript gist, so we'll choose JavaScript. And the point of choosing that is to set the syntax highlighting in the text area here. So let's just start out with some really simple boilerplate JavaScript. [BLANK_AUDIO] Okay, so super simple snippet of code there. We can add other files if we want. If we want the gist to comprise several files, then we can use the Add file button at the bottom there. And that will add a new text area for us, and let us choose which language and a name for that file. And on the right-hand side, we have two buttons here. We can create a secret gist or we can create a public gist. Now, even if we create a secret gist, it's still possible for anyone to come along and access that provided the have the URL for the gist. It doesn't lock it down as private, and it doesn't add any access controls so that people have to sign in with a particular username or anything like that. All it does is, is means that when people search for Gists, our secret Gist won't be shown in the search results. So let's just go ahead and create a public one, and it lists all of our Gists. So we have like a separate account for our Gists. They're still associated with our username, but it doesn't show any of our other repositories here. And when we go back to GitHub and look at our repositories, it won't show the Gists. And because each gist is actually a full repository, we can actually see the number of different revisions that have been made to this file. So if we come along later and change this file in some way, then the number of revisions will be updated. And we can leave comments, other people can leave comments, and it's a great way of sharing code. So if we want to get back to GitHub now, we need to hit the cats icon at the top of the page. The cat, by the way, is GitHub's logo, and it's called Octocat. So now we're back in our main GitHub page. We can see in the repositories box at the right-hand side, we do have a repository called project now. But it doesn't show the gist that we just created. So one more really useful area is the settings page, which we can access by clicking the cog in the header. So this is a really useful area where we can set things like our profile. We can change any account settings. We can update the plan that we are on if we want. We can look at the billing, any money that we might have paid towards a plan or any money that's outstanding, anything like that. The notification center is quite useful. If somebody comes along and adds a comment to one of your files in your repository, then that will show up in the notification center. And there's various other options as well. So, we will be coming back to this page in the next lesson when we set GitHub up as a remote repository. But in this lesson, we learned a bit about what Github is and why it's so useful. We created an account, and we saw how to create a new repository. We also looked at Gists, which are an easy way to share snippets of code. Thanks for watching.

Back to the top