Github Commands

Github basics in the terminal!

Card image cap

Step 1

Make sure you have a project ready and your own Github account and you've installed the Git commands when you install Github Desktop

Card image cap

Step 2

Locate the file path with ls and cd

Card image cap

Step 3

Make sure your project's main file is "index.html" with ls otherwise you'll get an error later on!

Card image cap

Step 4

Once in the directory, type git init

Card image cap

Step 5

Run the command git status

Card image cap

Step 6

Now enter git add .

Card image cap

Step 7

Run git status again to see the files tracked and staged

Card image cap

Step 8

To commit to your local repository, use git commit -m 'Initial commit'

Card image cap

Step 9

Go to your Github account and click the button to create the remote repository.

Card image cap

Step 10

Enter the Repository Name in the
and give it a description.

Card image cap

Step 11

Leave the   checked and click

Card image cap

Step 12

Push an existing repository from the command line by copying and pasting the commands shown on the page first.

Card image cap

Step 13

Paste the commands in the terminal, or enter them.
Example:git remote add origin https://github.com/craig-o-curtis/html_video.git
git push -u origin master
and hit enter.

Card image cap

Step 14

Back on the Github site, click on the repository link of your newly-pushed project.

Card image cap

Step 15

Now you should see your project on the Github website.

Card image cap

Step 16

In the terminal, create a new branch by entering git checkout -b gh-pages

Card image cap

Step 17

Run the command git branch and check the files are there by entering the ls command.

Card image cap

Step 18

Push the new branch to Github by entering git push origin gh-pages.

Card image cap

Step 19

 Refresh your GIthub page, click on the and you should see the dropdown:

gh-pages

Card image cap

Step 20

Your site is now being build by github.io, and this process takes no longer than 10 minutes. Check out your site at username.github.io/project_name.
Example: craig-o-curtis.github.io/html_video

Card image cap

Step 21

To update changes to your gh-pages, make sure you're in the gh-pages branch with git branch, and use git checkout gh-pages to go to the gh-pages branch.

Card image cap

Step 22

Run git status to see the modified: files on your computer.

Card image cap

Step 23

Add the updates to the staging area with the git add . command.

Card image cap

Step 24

Commit your updates to the staging area with git commit -m "updated".

Card image cap

Step 25

Finally, push to git pagesgit push origin gh-pages.

Card image cap

Step 26

Remember, you can also push your master branch and repeat steps to update that first and then the gh-pages branch.