Things to keep in mind
Git vs GitHub
“Git” (pronounced with a hard “g”, as in “give”) is the software that tracks versions of files on your computer. “GitHub” (also pronounced with a hard “g”) is the hosting platform that holds all versions of files tracked by Git.
Do not track files in folders on OneDrive or iCloud
You NEED to know where the difference between files on your actual, physical computer vs files held on OneDrive or iCloud. Git will not work properly with files on OneDrive or iCloud (in short, the cloud syncing does not work with version control).
For every folder you track with Git, you have to make sure it is not on OneDrive or iCloud.
One easy way make sure that your folders are on your actual computer (again, not on OneDrive or iCloud) is to create a folder called git
or github
outside of cloud folders. On my (An’s) computer (which is a Mac), the file path to this folder is Macintosh HD > Users > An > github
.
With Macs: your root directory is usually Macintosh HD.
With Windows: your root directory is the C: drive.
Stay calm and do not panic
You are going to run into problems down the line (when we use Git/GitHub in class) if you do not set this up correctly. PLEASE give yourself time to read the directions and follow the steps exactly as they are laid out. Additionally, reach out to An/Thuy-Tien/Grace for individual help with any of these steps.
Opportunities to get help before we start using Git/GitHub in class
We are going to start using Git/GitHub in class during week 7 (Thursday the 15th of May and Friday the 16th of May). You can get help in:
- drop-in hours (Wednesday the 7th, Friday the 9th, Wednesday the 14th, Thursday the 15th)
- in workshop on Thursday the 8th or Friday the 9th (come to any workshop meeting, you don’t have to come to the one you’re enrolled in)
In-class technical difficulties
Again, we are going to start using Git/GitHub in class during week 7. If you do not set things up correctly on your own AND/OR if you do not get help during workshop or drop-in, we will not stop to help you.
YOU NEED TO SET EVERYTHING UP CORRECTLY BEFORE WEEK 7 WORKSHOP.
Steps
1. Create a GitHub account
If you don’t have one already, create a GitHub account.
Use your personal email, not your ucsb.edu email (because you will lose access to that email once you graduate).
2. Check that you have git
on your computer
Open RStudio. Open the Terminal.
If you are on a Mac, type which git
and hit Enter.
If you are using a Windows machine, type where git
and hit Enter.
Click on any screenshot to make it bigger!
You should see something pop up that looks like a file path. It might look slightly different from this example, which is ok.
If you do not see a file path, you’ll need to install git
: https://git-scm.com/downloads
Most Macs come with git pre-installed. If you are using a Mac and you do not get a file path when you run which git
, email An.
3. Set your username and email
In the Terminal, type git config --global user.name "your-username-here"
(replace your-username-here
) with your actual user name. Hit Enter.
None of the steps in the Terminal will work without the right spaces, dashes, etc.
Then (still in the Terminal), type git config --global user.email your-email-here
(replace your-email-here
) with your email. No quotation marks around your email!
Then (again, still in the Terminal), type git config --list --global
. You should see your user name under the user.name
field, and your email under the user.email
field.
Congratulations! You have successfully completed the precheck steps.
Now go to Git/GitHub Part 2: setting your personal access token.