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 selectNew 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.
- There are some files that GitHub needs to ignore when files are pushed to the repository. For example: When working with Node.js, select
- Select
Create repository
How to Protect the Master Branch:
From GitHub:
- Select the
Settings
tab
- From the
Options
menu on the left-hand side selectBranches
- Select the
Add rule
box at the right-hand side ofBranch protection rules
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
Clone the Repository:
In GitHub:
- To clone the repository, select
clone
to copy the link
In the Terminal:
- Go into
Terminal
and use the commandcd
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:
- Part One: Reference Guide: Common Commands for Terminal.
- Part two: Create a GitHub Repository
- Part three: Committing Changes
- Part four: Committing Changes with Branches -Part five: Merge Conflicts
- Part six: Pull Requests
- Part seven: Conducting a Code Review -Part eight: Complete and Merge a Pull Request
Top comments (0)