Lectures‎ > ‎

Week03

Using git and GitHub for Projects

Use the following link posted to Piazza to create a GitHub repository for Project01:

  

You will need to install git on your RPi (your RPi must be connected to the Internet):

 

$ sudo apt-get install git

 

You may have to update apt on your RPi:

 

$ sudo apt-get update

 

After you have git installed you can clone the repo you created with the link above. I put all my git repos in a single location for a class. For example, in my home directory I create:

 

$ cd

$ mkdir cs315

$ cd cs315

$ mkdir git

$ cd git

 

(now you are in /home/pi/cs315/git)

 

$ git clone https://github.com/USF-CS315-F17/project01-<username>.git 

 

(you will use your URL, not this one)

 

Once cloned, you can cd into the repo:

 

$ cd project01-<username>

 

Create a README:

 

$ echo "# project01-gdbenson" >> README.md

 

Then add it to the repo:

 

$ git add README.md

 

Then commit:

 

$ git commit -m "Added a README"

 

You will get an error the first time. It will ask you to config git with your email and username. Follow the given directions.

 

Once you have done this, commit again:

 

$ git commit -m "Added a README"

 

Then push your changes to GitHub:

 

$ git push

 

Now you can added new files or make changes. You always need to explicitly add files with git add. Then you need to commit, then push.

 

We will go over how to use git from the command line on your RPi to clone your repo and to commit and push your changes.

 

I will demo this in class in case you have more questions.


Comments