Git  and GitHub


We typically use course repos located on the SoC's git repo (see this link).  Note you need to access this site from within Clemson's network.  If you are remote, you must use the clemson VPN  (see this ccit page).

To use git on your Linux machine, you will need to issue  'sudo apt install git-core' .   Also, after installing,  it might ask you to issue the two git commands below to configure your local repo with your contact information.  This might only be required if you are working with a repo and you issue git   add, commit, push.

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

On buffet,  you should see that the student version of our course repo is listed with access control 'anonymous'.   This means anyone with a VPN connection to our campus network can issue a git clone url   to obtain a local copy.     Example:

We begin with a short list of git commands:


Git is open source software that you can use locally on your own computer, or in a shared manner at an organization.  GitHub.com (described in more detail further down this page)  is the largest repository host provider that uses git. There are other git repository providers such as BitBucket and GitLab.
 

On Ubuntu, issue the following commands in a terminal session:


Refer to this article for a very good overview: https://git-scm.com/book/en/v2.    This is an open source book - a pdf is available. I highly recommend reading at least chapters 1 and 2. You might want to print this handy cheat sheet. 

To setup the server code on your machine, you follow these instructions: https://www.linux.com/learn/how-run-your-own-git-server.  
For our class, you just need to use the git client.  We will use the SoC's git repo (housed at  https://buffet.cs.clemson.edu/   ) You should be able to make your own repo and control who can access it.  If you decide to allow anyone to access your repo, you would check the 'anonymous' button in the repo setup page.

As an example, I've created the following repo for our class (with anonymous access): anonymous@buffet.cs.clemson.edu:jmarty/CPSC6240-Student
Most source code control systems (including git), use URL's to identify the specific repo at a given repo server/system name. If you want to obtain a copy of the master branch of the repo on a system (that has a git client), you must issue a clone operation.  On Ubuntu, let's say user alice would like to clone our course git repo. A git clone operation is equivalent to 'making a local copy' of the repo.  In a terminal Alice would  issue:
                    'git clone anonymous@buffet.cs.clemson.edu:jmarty/CPSC6240-Student'

 Alice should see files in the subdirectory CPSC6240-Student.  The following summarizes the small number of git commands we need to get started.

You are encouraged to make a repo on buffet for your own (or for your group's) purposes this semester.  I won't (or don't) need access -  so this does not replace any submission instructions for homework or other items in our course.   Follow the instructions from buffet.  Each time you (or an authorized user with read/write access) need to submit changes or to add new code to the master branch, follow these instructions. 

 

GitHub:
 


You should obtain an account on github (if you don't already have one) :  https://github.com/   
When you are looking for a job,  companies first will look for any/all of your social media activity and github (or other open git repositories).  You should try to have at least one open source project you contribute.
 

GitHub is an online repository, based on the  git open source code, that can be used by virtually anyone.  GitHub is a business – a ‘cloud service operator’ that provides coding project tools and services..  They offer their service free to single individuals – any number of external users can access the code but a limited number can contribute (it used to be 0,  I’ve heard it is now 3). This single page PDF summarizes the 'GitHub flow' . 
https://guides.github.com/pdfs/githubflow-online.pdf.   This link is a very simple tutorial that will help you make your first repo: 
https://guides.github.com/activities/hello-world/

The ‘GitHub’ flow refers to the typical use case and corresponding work flow.  The use case can be as simple as :  a software project that has one or more developers contributing code.  The work flow, as summarized in this GitHub page (https://guides.github.com/pdfs/githubflow-online.pdf ), involves (assuming the GitFlow project already exists):
•    Create a branch in the project so you can work with the code, make changes,  using the branch to maintain your changes but not impacting others.
•    Issue a pull request – this can be used on a team to stimulate a code review before your code is checked into the main branch
•    Merge your branch into the master branch.
 

Github is intended primarily for open source projects - there might be limits as to how you use github to a small group of colleagues. One interesting page is the projects that are trending (for the current day ) : https://github.com/trending . Github is a commercial entity and so they have various methods for making money. For example, a company might chose github to host their internal company repos. Github has a market place that (I'm guessing here) is somewhat similar to google's app marketplace.


Last update 9/15/2021