User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

teaching:getting-started-with-git [2019/01/25 15:37] (current)
seanburns created
Line 1: Line 1:
 +# Getting started with Git and GitHub
 +## Date: Wed 30 Jan 2019 
 +## Goals
 +Our goals this week include:
 +1. Setting up Git on our local machine
 +2. Creating a remote repository on [GitHub][1]
 +3. Initializing a local repository on your local machine
 +4. Creating website architecture, i.e., base files and directories for
 +   your website, on our local repository
 +5. Staging, committing, and pushing those files to our remote repository
 +Basic definitions:
 +- Git is the open source distributed version control system
 +- GitHub is a hosting service that developers use to manage projects
 +  using Git and it includes Git technologies on the website. There are
 +  other Git hosting services. A newer and increasingly popular one is
 +  called [GitLab][2].
 +## Setting up Git on our local machine
 +First, you should configure Git on your local machine (this part has
 +nothing to do with GitHub). Following the instructions at the link
 +below, assuming you have already downloaded Git onto your machine. This
 +will configure Git to track your name and email address, which is an
 +important part of version control.
 +Configure user name:
 +Configure email address:
 +I won't provide the instructions here in this transcript because it will
 +vary a little bit based on your operating system. Do follow the
 +instructions for configuring Git for *every* repository and not just a
 +single repository.
 +## Create a remote repository
 +1. Sign-in to your GitHub account
 +2. Click on the Plus/Drop-down icon at the top of the screen and select,
 +   *New repository*.
 +3. Add a name for your repository. Do not click on the *Initialize this
 +   repository with a README* file.
 +4. You will need the URL for your remote repository. GitHub offers two
 +   protocols for connecting to remote: HTTPS and SSH. Select the HTTPS
 +   protocol.
 +## Initialize a local repository on your local machine
 +1. On your local machine, pick a suitable location for your web
 +   development project, create a folder (can be the same name as the
 +   repository you created on GitHub).
 +2. Now, navigate to that folder on your machine using the command line
 +   for your operating system. If you're using a Windows machine, you may
 +   want to consult GitHub documentation (YouTube videos, etc.) for how
 +   to accomplish this, or you may want to seek help from your
 +   classmates.
 +3. Then, follow the instructions on the GitHub screen under the section
 +   titled **...or create a new repository on the command line**. This
 +   must be done within the base folder that you created. 
 +Congratulations, you have now initialized your first repository, staged
 +your first files, and pushed them to the remote repository (i.e., your
 +GitHub repo).
 +## Create website architecture 
 +1. In that folder, create the following files and sub-folders (aka,
 +   directories):
 +    - a file named: **index.html**
 +    - a file named: **.gitignore**
 +    - a folder named: **images**
 +    - a folder named: **styles**
 +    - a folder named: **scripts**
 +## Stage, commit, and push to remote repository
 +1. We have now made changes to our local repository that we need to
 +   stage, commit, and push to our remote repository. To do that, we'll
 +   repeat, but modify, the commands we used to create the repository on
 +   the command line:
 +git status
 +git add *
 +git commit -m "set up website architecture"
 +git push origin master
 +Congratulations again! Now we are *gitting*. We don't have to stage,
 +commit, and push all file modifications. We can repeat this process
 +after each session or after reaching certain goals, but it's okay to do
 +it often because by pushing changes to remote, we also backup those
 +changes, which would allow us to pull them in case of loss. We also, by
 +doing this process, create the ability to revert to different versions
 +of our project in case we have made a mistake.
teaching/getting-started-with-git.txt ยท Last modified: 2019/01/25 15:37 by seanburns