GitHub Tips
Create GitHub Account
Follow instructions below to make a personal account:
https://docs.github.com/en/get-started/start-your-journey/creating-an-account-on-github
It also helps to download the GitHub app on your smartphone, to do two-factor authentication (similar to Authenticator for PSU accounts)
Once you have created an account, email the instructor (jxz224@psu.edu) and TA (jcr6048@psu.edu) with
- The GitHub User ID
- Email you used when creating the account
and we will add you to the Astro 410 organization.
First time Classroom 50 setup
This portion will consist of four steps: accept your first assignment (lecture 1), configure your identity+email, creating a GitHub classic token, and then loggin-in and submitting the first lecture, which will save your login information for future submissions.
If you encounter issues with submitting assignments in the future, try repeating the commands below.
Accepting first assignment
To accept this assignment on Classroom 50 with your GitHub profile enrolled in the class, click on the link
https://classroom50.org/PsuAstro410/410astro26/assignments/lecture-1/accept
and follow the steps the webpage prompts.
Configure Git with your name and email
Initialize Git through the commands
git config --global user.name "Your Name"
git config --global user.email "your_email@psu.edu"
git config --global credential.helper store
If you do not also enter the last command, you will have to repeat this process every time you submit an assignment using RC.
Creating a GitHub Classic Token
- Login to your GitHub profile, and click onto your user avatar.
- When navigation pops up, click on Settings
- Click on Developer Settings
- Click on Personal Access Tokens, then Tokens (classic). Do not click on Fine-Grained Tokens
- Click Generate new token, and Generate new token (classic). Again, do not click on Fine-Grained Tokens
- Carry out two-factor authentication
- Click all boxes on your personal access token.
- Keep the window open, so that you may copy and paste the personal access token when accessing git on Roar Collab.
First-time login with Classroom 50
- Access the Roar Portal
- Click on RC Shell Access
- Create a new directory for lectures in you home directory with
mkdir lectures - Change your directory to the lectures directory with
cd lectures - Download the first lecture
lec1.ipynbby entering
curl -O https://raw.githubusercontent.com/PsuAstro410/psuastro410.github.io/main/lectures/lec1.ipynb. - Clone the first lecture with a command like
git clone https://github.com/PsuAstro410/410astro26-lecture-1-<git_username>.git - Enter first your GitHub User ID
- Using the open window with the GitHub Classic Token, paste the Token when asked for a “password”
If everything worked, check:
-
When you enter
ls
you should have a new directory titled
410astro26-lecture-1-<your git ID>. -
After entering
git config --global credential.helper.
the terminal should return your User ID with an unintelligible string of letters and numbers, which is your token.
Accepting and Submitting Assignments:
Follow instructions below to accept assignments on GitHub using Classroom 50:
https://github.com/foundation50/classroom50/wiki/Web-Student-Guide
Accept links are available on Canvas, as well as this website. Click on the link to the repository, there should be a website url with a .git file at the end of it. Keep this open, as we will use it in a bit.
Change directory to the assignment directory, using cd lecture, cd homework, or cd exam, from the home directory. Enter the command
git clone https://github.com/PsuAstro410/410astro26-<assignment_name>-<GitHub_user_name>.git
The clone url should also be visible on the webpage GitHub directed you to after you clicked on “take me to GitHub repository.” After cloning, you should have gotten a message which read something like “You have cloned an empty repository.” This is fine.
Download the .ipynb template (lecture, homework, or exam) using
curl -O https://raw.githubusercontent.com/PsuAstro410/psuastro410.github.io/main/<template_path>/<template>.ipynb
Homeworks will have <tamplate_path>=homeworks, and lectures will have <template_path>=lectures. The <template> is e.g. hw1, lec1, etc.
Add the assignment to the git “staging area” using
git add <assignment_name>.ipynb
Keep track of changes using
git commit -m "<a description of the modification>"
When you are ready to submit the assignment, comment
git commit -m "submit"
then submit to the instructor and TA using
git push