In this course we'll learn all about the excellent source control management system Git. We'll also see how we can use the brilliant GitHub as a remote source of our Git repositories and as a way to share code with our fellow developers.
Got ten minutes? Why not dive into Git fundamentals in our Coffee Break Courses:
1.Introduction3 lessons, 16:39
2.Git Basics5 lessons, 40:43
3.Branching and Tagging5 lessons, 36:16
4.GitHub and Remotes4 lessons, 39:34
5.Intermediate Usage3 lessons, 22:04
6.Conclusion1 lesson, 01:16
1.2 Installing and Configuring Git
Hi, folks. In this lesson, we're going to get Git installed and configured, ready for us to use. How you install this depends, of course, on the platform that you're on. Linux users will typically use a package manager to install Git, while OS X users could use either the Git installer or something like HomeBrew to install it. Equally, Windows users could use the Git installer or it can be installed by other various means. Windows users, such as myself, who need to be spend a lot of time in the console, will probably want to install a console emulator that provides an improved command line experience and a decent level of Git integration. One such tool is Cmder, spelt C-M-D-E-R. Not only does this give us a much improved command line experience on Windows, it also provides some special and very useful Git integration features, and even includes Git itself. So in some ways, this is everything we need on the Windows platform. So let's head on over to the Cmder site and download it. So the site's URL is bliker.github.io/cmder. It doesn't have an installer, but there's a package that we can download. So let's just scroll down near the bottom of the page, and there's this Download full button. We'll click that. And we'll just wait for the package to download. As you can see, it's coming down pretty quickly. And once that's downloaded, we need to open the folder, and we can unpack the archive. So we'll just wait for that to unzip. This will probably take longer than the download. So once that's unzipped, we can just copy the entire folder over to somewhere more useful. I'm just going to drop that in the Program Files folder. And again, we just need to wait for that to copy over. And if we just go into the directory now, we can see that there is a file in here called Cmdr.exe. I'm just going to pin that to my taskbar. That's basically installed. So, as I said, this program actually includes a version of Git, so let's just run the application now. And this is what the console looks like in Cmdr. And if we just run git --version, that will tell us the version number of Git that comes with Cmdr. And as you can see, it's version 1.9.4. However, a security vulnerability was recently discovered in this version of Git. So, what I actually want to upgrade this version. To do that, we'll need the installer. So, if we head on over to the Git website, this is where we can download Git for various different platforms. As you can see, there are installers for Mac OS X, Windows, Solaris, and Linux. I believe the Linux version is actually the source, which we'll need to build ourself. I'm gonna download the Windows version now. So again, we just need to wait for that to download. Once that's downloaded, we can just run the installer. And we can just use all of the defaults. And we'll just wait for that to install. And I'm, don't want to read the release notes, so I'm gonna uncheck that box. And once that's installed, that will actually put a Git folder in our Program Files folder, so I'm just gonna go to that now. And it's actually in the Program Files x86 folder. Here's the Git folder. I'm just gonna go in there now. And what I'm gonna do is just copy all of these items. And now I'm gonna head back to the Cmdr folder, and I'm just going to close Cmdr down now. And if we go into the vendor folder, then we can see that there's a folder in here called msysgit. So I'm just going to go into here, and I'm gonna paste in all of the files that I've just copied from the Git folder. So we just need to wait for these to copy across. And I'm going to replace all of the files. [BLANK_AUDIO] So that's happened now. If we close this down, and we can run Cmdr again. And when we run git --version this time, we should hopefully have a higher version number. So we're now running the more secure Git version 1.9.5. Great. So now we have just a little bit of configuration to get out of the way before we can really get started. So whenever we perform some kind of Git related action, Git is going to want to record who exactly carried out that action. So one thing we should do is tell Git who we are. We should set an email address and a username for Git to use. There are several different levels that we can set configuration on. These are the system level, which applies to all users on a single computer, the global level, which applies the configuration for a particular user on a computer, or there is the local level, which only applies settings to a specific Git repository. So let's set our username and our email address, which we can do at the global level, so that the information can be used in every repository we create. To set configuration, we need to use the config command. So let's just run that now. And we supply the global flag to make the configuration change global. And we're just gonna set the user.name value. And I'm just gonna add my name. You can add your name if you want. And I'm just gonna press Enter now. So we don't get any feedback there, but we should be able to verify that the change has happened if we run this command now. [BLANK_AUDIO] And we can see that the name is set to Dan. It's already got my email address in there, but I'm just gonna show you how to set that. So let's come out of Vim now. And we can set the email address in exactly the same way. [BLANK_AUDIO] Great. So just in case you're wondering where that global config file actually get stored, on different platforms, it's in different places. On Windows, it will be in the user folder. On Mac, it will be in the home directory. And let's just take a look at that file. [BLANK_AUDIO] And if we go into the User folder and into our user folder. So my user folder, as you can see, is called Dan. That's, that's my name on this computer. And if we go all the way down to the bottom, we should see a file here called gitconfig. That's .getconfig. If we just open this up in a text editor, then we see the same file that we just saw in Vim. So I just wanna show you one more really useful thing. If we ever need help with the git command, and we wanna see what options we can pass, or the exact format, or anything else like that, then we can enter the command followed by --help. [BLANK_AUDIO] So let's take a look at the help for the config command, [BLANK_AUDIO] And as you can see, what actually happens is that our default browser is launched, and we get a nice HTML formatted page that shows us all of the different options that we can use with whichever command we passed help to. So in this lesson, we installed Git and did the basic configuration to get it ready for us to use. We saw how to use the Git config command and looked at the different levels that configuration can have. We also saw where these global configuration settings are stored. Thanks for watching.