GitHub – How to Set Up and Use

Setting up your GitHub repository for the first time:

1) Go to and sign into your profile

2) Click on the “+” button (on the top right), and then “New repository”

3) Choose name and description of repository

4) Make sure you set the repository to “Private”

5) Click on “Create repository”

6) Open your Bash terminal and go to the directory that you wish to make your local repository

7) Initialize the directory as a Git repository (type the following in terminal):

git init

8) Make a file called “.gitignore”:

touch .gitignore

(Note: The file .gitignore specifies which files you do NOT want to add to your GitHub repository; this is useful if they take up too much space, for example.)

9) Open .gitignore using your favorite text editor and specify which files to ignore; for example, if you want to ignore all pdf and jpeg files, add the following two lines:


10) Add all of the files in this directory (that are not being ignored) to your repository:

git add -A

11) Commit these changes (i.e., get them ready to send to GitHub):

git commit -m "This is my first commit"

12) Connect your local repository to your GitHub repository:

git remote add origin your_repository_url_here

13) Push the changes in your local repository to GitHub:

git push -u origin master

Saving new changes to your existing GitHub repository:

Now that your repository is set up, you only need to run the following 3 Bash commands in your local repository any time you wish save new changes:

git add -A
git commit -m "Brief description of the new changes"
git push