In today’s Ask the Admin, I’ll show you how to get started with GitHub for Windows – the open source distributed version control system.
As a system administrator, you may think that you don’t have much need for Git. After all, isn’t that a developer thing? But with the industry moving ever faster towards the cloud and DevOps, sysadmins need to understand technologies such as Puppet, Chef, PowerShell DSC, and JSON.
An integrated scripting environment in principle is all you need to work with the code required to use the technologies I mentioned above, or even Notepad might do. But that is until you start collaborating with colleagues on a regular basis. Keeping track of who has made what changes to code can become a headache, and is reflected in the quality of code you produce and the time it takes to complete projects, so some kind of versioning control becomes as important as for any other file type.
That’s where Git and GitHub step in, although by no means the only version control system available, with Microsoft’s own Team Foundation Version Control (TFVC) that’s built in to Visual Studio Online coming to mind, GitHub is one of the most widely adopted.
Git keeps track of the changes you make to local copies of repositories, and then allows you to sync changes back to the server. If a merge conflict occurs, when two or more people have modified the same line of code, Git flags the conflicts so that you can resolve them manually. For more information on Git, GitHub and version control, see What is GitHub? and Create a GitHub Repository on the Petri IT Knowledgebase.
Note that I have already a GitHub account, have created a repository using the GitHub website, and initialized it, which allows me to clone it in GitHub for Windows.
You can add or remove accounts after the initial installation by following the instructions below.
Now that GitHub for Windows is installed and you have logged in, let’s clone a repository. There are two ways to do this.
To modify files in your repository, you don’t use GitHub for Windows. File Explorer and your favorite editors are still used for that task. Although, you can use GitHub for Windows to open the local clone of your repository by right-clicking a repo in the list on the left of GitHub for Windows and selecting Open in Explorer from the menu.
While you are editing or adding files to your repo externally, GitHub for Windows keeps track of the changes that are being made to files and folders in each repo, and then syncs them back to the server copy of the repository once you’ve manually committed the changes.
Before you can add a file to a repository, you must commit it. GitHub for Windows shows the files that have been changed or added, and you can either individually or collectively commit them.
That covers the basics. In my next article on GitHub for Windows, I’ll show you how to add branches to your repo, create pull requests and deal with merge conflicts.