Create a GitHub Repository
In today’s Ask the Admin, I’ll show you how to create a repo in GitHub that you can use with Azure DevTest Labs.
As we move more towards using declarative configuration technologies like Azure Resource Manager (ARM), PowerShell Desired State Configuration (DSC), and in the not too distant future Azure Stack for Windows Server 2016, I’m gradually coming to the conclusion that there’s now a pressing need to adopt, even if at a basic level, DevOps practices such as using git to manage code. See What is GitHub? on the Petri IT Knowledgebase for more information.
Once you start using templates and PowerShell scripts for server deployment and management, you also need to find a suitable way to manage and develop those scripts in collaboration with your colleagues. OneDrive and SharePoint are good solutions for working with Office documents, but don’t lend themselves to code development.
Push came to shove recently when I started to move my Azure VMs to DevTest Labs, a new feature that enables organizations to better manage lab environments in the cloud. Artifacts can be stored in Visual Studio Online (VSO) or GitHub repositories (repo) to allow developers to quickly deploy configurations to VMs, but while there’s a default public GitHub repo available with a selection of artifacts, I wanted to create my own artifact that runs a PowerShell script. And to do that you need your own repo.
Create a new repo in GitHub
Before starting, create a free account on GitHub. There are several different ways to create new GitHub repos, such as using GitHub for Windows and PowerShell, but to keep it as simple as possible, I’ll use the GitHub website.
Also bear in mind that free accounts can’t create private repos, so if keeping your code away from prying eyes is important, you might want to consider using a VSO Team Services repo instead, which I’ll cover in a later article.
- If you haven’t done so already, log in to GitHub here.
- In the top right of the GitHub site, click + to the left of your avatar, and select New repository from the menu. Alternatively, scroll to the bottom of the screen and click New repository in the Your repositories box on the right.
- On the Create a new repository screen, enter a name for the new repo in the Repository name field.
- Add a description, and make sure that Public is selected if you have a free account.
- Check Initialize this repository with a README. This is important for easy initialization of the repo.
- Optionally, you can also choose from one of three open source licenses to apply to the code hosted in the repo using the Add a license menu. For more information about the available licenses, click here.
- Finally, click Create repository at the bottom of the browser window.
- The new repo will now appear in the browser window.
Create a folder
Azure requires that artifacts be stored in a folder and not in the root directory of a repo branch. It’s important to understand that git doesn’t support empty folders, and while creating a folder is easy, it’s not intuitive.
- If it’s not already open, go to the new repository by clicking it in the Your repositories box on the GitHub homepage.
- In the repository window, click the Create new file button.
- On the file edit screen, enter a path name for the new file, including its folder name. For instance, if you want to create a new folder called artifacts, type artifacts/readme.md as shown in the screenshot below. The readme.md file can be empty.
- Now scroll to the bottom of the page and click Commit new file.
- You’ll be returned to the main repository page where you should now see the new file listed.
- Go up a level by clicking on the repo name, in my case petri_testing, to see the root of the selected branch. The new folder should now be listed.
In this article, I showed you how to create a public repo in GitHub and create a folder for use with Azure DevTest Labs artifact repositories.