New Project

For this exercise we want you to go through the process of:

  1. creating a new local repo
  2. creating a new remote repo
  3. adding the remote repo to the local repo
  4. adding files
  5. going through the basic git workflow

Creating a New Local Repo

From your home directory create a new directory called hello-git.

Initialize the hello-git/ directory as a local git repository.

Solution

CLICK FOR ANSWER
cd ~
mkdir hello-git
cd hello-git
git init

Creating a New Remote Repo

Create a new remote repo on your personal GitHub account named hello-git.

Solution

CLICK FOR ANSWER

Create New Remote Repo Dropdown

alt-text alt-text

Fill Out Form & Submit

alt-text alt-text

From here you must click Create repository.

Adding Remote Repo to Local Repo

CLICK FOR ANSWER

Copy Remote Repo URI

alt-text alt-text

Add New Remote to Local Remote via Terminal

cd ~
cd hello-git
git remote add origin [copied-remote-URI]

Adding Files to Local Directory

Add a file called myname.txt and add your name to the contents of the file.

CLICK FOR ANSWER
cd ~
cd hello-git
echo "Paul Matthews" > myname.txt

Basic Git Workflow

Add the file to staging, commit the staged changes, and push the commit to the remote repo.

CLICK FOR ANSWER
cd ~
cd hello-git
git add myname.txt
git commit -m "added myname.txt" -m "Contents of file contains my name."
git push origin master

After you should be able to see the changes on your remote repo.

alt-text alt-text