GitHub for Windows – Installation, Adding Accounts, Committing Changes, and Syncing Repos

Posted on July 26, 2016 by Russell Smith in Cloud Computing with

Use GitHub with your PowerShell scripts to be more productive.

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.

Install GitHub for Windows

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.

  • Start by downloading GitHub for Windows here, run the executable file and click Install.
  • GitHub for Windows should automatically open, but if not, double-click the GitHub for Windows icon on the desktop.
  • On the Welcome screen, type your GitHub username and password, and then click Log in.
  • Next you’ll be asked to confirm your name and email address that’s used when commenting. Click Continue.
  • Finally, assuming that you don’t have any existing local repositories that you want to add, click Skip to move to the dashboard.
Accounts in GitHub for Windows (Image Credit: Russell Smith)

Accounts in GitHub for Windows (Image Credit: Russell Smith)

Add Accounts

You can add or remove accounts after the initial installation by following the instructions below.

  • Click the Tools and options icon in the top right of GitHub for Windows, and select Options from the menu.
  • On the Options screen, click + Add account.
  • On the Log in screen, type your GitHub username and password, and then click Log in.

Clone a Repository

Now that GitHub for Windows is installed and you have logged in, let’s clone a repository. There are two ways to do this.

Cloning a repository in GitHub for Windows (Image Credit: Russell Smith)

Cloning a repository in GitHub for Windows (Image Credit: Russell Smith)

  • The first way is to open the repository online in GitHub, click Clone or download on the <Code> tab, and then click Open in Desktop.
  • If you’re using Microsoft Edge, you’ll be prompted to switch apps. Click Yes.
  • Then you’ll need to select a local directory for storing the clone. By default, this will be the GitHub directory created when GitHub for Windows was installed. Either way, choose a folder and click OK.
  • Depending on the size of the repo, it might take a few minutes to clone.
  • Alternatively, you can click the + icon in the top left of GitHub for Windows, click Clone and then select one of the available repositories.

Committing Changes and Syncing Repositories

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.

Committing changes in GitHub for Windows (Image Credit: Russell Smith)

Committing changes in GitHub for Windows (Image Credit: Russell Smith)

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.

  • To see changes to the local clone of a repository, click Changes at the top of GitHub for Windows.
  • To select all changes files and folders, check the box to the left of the number of changes at the top of the list.
  • Or select individual files and folders to commit.
  • Once you’ve selected the files and folders, enter a summary and optional description, and then click Commit to master.
  • To upload the changes to GitHub, click Sync in the top right corner.

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.

Tagged with , ,

Register for this Webinar

How Replication Supports Your Company’s RTOs & RPOs
Join us for this free webinar

Can you have your workloads running within the agreed RTOs? Join this webinar with expert speakers from Veeam to exceed business objectives with an RPTO<15 min for ALL of your application and data.

Thursday, December 14, 2017 at 11 a.m EST