Even though I’ve been to God knows how many developer meetups and events where everyone seems to be using GitHub, I’ve only recently got round to setting up an account there. I don’t really do much in the way of collaborative development outside my day job these days, and I’ve been working almost exclusively with Visual Studio and TFS. I wanted to put together a repository of hacks and useful code for junior developers that might be joining us, though.
Setting up a Repository and Mapping
Getting started was a simple matter of creating a repository through the GitHub site, installing a few client applications and mapping the repository to local directories. By far the easiest way is to use the official GitHub desktop client. I’m also using GitKraken on another machine, and Git-Cola on a Linux system.
Even if there are no source files present, the Git client will at least create a sub-directory containing a .git file.
Now it’s possible to add source files to the directory and use the desktop client to push them to the server. New and modified files appear in the desktop client under the ‘Changes‘ tab. You’ll need to click ‘Commit to master‘ and the Sync button. For Cola Git, the changes must be staged, committed then pushed.
Visual Studio Code
Git version control is integrated into Visual Studio Code. The editor will read the .git file when opening the local folder containing a repository clone.
And to check in the changes, the Git version control button opens the version control tab.
But it seems the changes still need to be pushed to GitHub using the client application.
A GitHub account can also be used for hosting Web sites, which could be better than a wiki and a list of repos. The way to go about doing this is to create a new repository, but this time name it ‘[username].github.io‘. We want a README here also.
The Master branch should be set as the source in the GitHub Pages section of the repository settings.
Technically all that’s needed here now is an index.html, and whatever else would make up the site. Of course, the site files can be cloned, modified and checked back in using the version control system for offline editing.