GitHub is a tool fairly new to the Instructional Technology Collaborators although some of us have used GitHub in support of academic requirements. Today’s #TechTipThursday will introduce users to the set up and initial use of GitHub as a collaborative tool for coding projects. This post focuses on the tool’s web interface but there are other options for working with a GitHub repository. To enhance the collaborative efforts possible through GitHub, users may wish to explore the list of tools available in the Integrations Directory.
Creating a GitHub repository
To start a GitHub project, you must first create a repository in which to store the files for your code. In general, a repository should store all the files needed for a project, but should also only store the code for a single project. To create a repository, click the plus icon in the upper right hand corner of the screen and select “New repository”.
Setting Up Your New Repository
This will take you to a screen where you name your repository and fill out the type of repository you want. If you want to make a private repository, you must pay to upgrade your GitHub account. This page also lets you initialize your repository for a README, a .gitignore file that will cause files listed in that file to be ignored by commands like “git add *” from the command line or when uploading all the files in your local directory to your repository, and a license file if you want your code to be associated with a particular person/production company. *Note: you cannot have two repositories with the same name. In order to start working with your repository, you need to have at least one file in it, so we recommend initializing with a README file.
In order to add people to work on your repository, go to the settings tab in the upper bar, then select collaborators from the left hand bar. This will take you to a screen where you can add collaborators, by username or email addresses once they’ve created a GitHub account, to edit the project.
Working in a Git Repository
Once you’ve added the collaborators, you can start working on your project. From the main screen you can add new files, click on the name of a file from the file list at the top of the page to edit it and commit your changes when you’re done. The “Clone or download” button lets you duplicate all of the files in the repository on your own desktop. You can use this along with a command line interface to keep an actively updated directory in an environment where you can compile code. When working from command line, the general workflow is to, from within the cloned directory: git pull, edit files, git pull, git add <edited files or *>, git commit, git push
If you have any questions, or difficulty duplicating the steps detailed in this post, please do not hesitate to contact us directly.
*This post was drafted by Michael, an Instructional Technology Collaborator.