DEV Community

Cover image for Reference Guide: Create a GitHub Repository
kymiddleton
kymiddleton

Posted on • Edited on

Reference Guide: Create a GitHub Repository

Welcome to part two of my reference guide series!
Go here for Part One: Reference Guide: Common Commands for Terminal.

GitHub is a web-based hosting service for version control using Git.

To create a repository go to GitHub:

  • At the top right corner of the webpage click the + sign and select New Repository.
  • Enter a name for the repository in the provided field. Use dashes instead of spaces.
  • Select Initialize This Repository with a README file.
  • Click the arrow on Add .gitignore
    • There are some files that GitHub needs to ignore when files are pushed to the repository. For example: When working with Node.js, select Node from the list.

gitignore

  • Select Create repository

How to Protect the Master Branch:
From GitHub:

  • Select the Settings tab

settings

  • From the Options menu on the left-hand side select Branches
  • Select the Add rule box at the right-hand side of Branch protection rules

branch protection

At the top of the screen there will be a prompt to enter the branch name.

  • Apply rule to Master or branch name
  • Select the Require pull request reviews before merging
  • Select Include administrators
  • Select Create
  • Select Save changes

rule settings

Clone the Repository:
In GitHub:

  • To clone the repository, select clone to copy the link

In the Terminal:

  • Go into Terminal and use the command cd to move into the folder where the repository will be stored and accessed.
  • Once inside the file, or root directory, where the project will be stored enter the following commands.
  • git clone <paste copied link from GitHub>
    • This step creates a link between the local files and the repository files.

Stay tuned for part three: Committing Changes.

For the completed Reference Guide Series:

Top comments (0)