Due: Friday 09/13 10:00am
Important Note
- The Dojo is open! You can stop by 307 today 3:45 - 5, they are very good at helping with Github issues!
- On Thursday 9/12 more was added to this assignment that must be done from your home computer. The addition starts at Clone Your Repository
Preamble:
- The notes page has some more detailed information about the terminal, git and GitHub similar to what we discussed in class today.
Windows Users Only:
Download & install https://gitforwindows.org/. It provides a number of useful utilities for navigating git in a windows environment. Including a git and windows friendly terminal environment called gitbash.
SSH Key Setup
- Create SSH keys for your home computer and upload the public key to GitHub. You should be able to do this in Terminal on MacOS or linux or Gitbash on Windows.
$ ssh-keygen -b 4096
- You will then be prompted to select a location for the keys that will be generated (keep the default).
- The keys will be stored in the
~/.ssh
directory. - The private key will be called
id_rsa
and the associated public key will be calledid_rsa.pub
. - You will then be prompted to provide a password protect this key, please use a secure password for this.
Add your public ssh key to GitHub
- Use
cat
to display the contents of your public key in the terminal:$ cat ~/.ssh/id_rsa.pub
- Log into your GitHub account in a web browser
- In the upper-right corner of any page, click your profile “photo”, then click Settings.
- In the user settings sidebar, click SSH and GPG keys.
- Click “New SSH key” or “Add SSH key”.
- Paste your entire public key into the “Key” field.
- And add a label to the “title” field (e.g. “home laptop”)
- Click “Add SSH key” and possibly, confirm your git password.
Test Your Keys
- Use the following command:
$ ssh -T git@github.com
- You will be prompted to type the ssh-key password that you chose when creating the key.
- Read the response message from the above step! If it worked, you should see a message like this:
Hi jonalf! You've successfully authenticated, but GitHub does not provide shell access.
Clone Your Repository
- Find your repository on the GitHub website.
- Should look something like https://github.com/stuycs-gh-classrooms/05-nextcs-work-jonalf).
- Get the clone link. You can find this through the green Code button. Make sure to select ssh.
- The link should look like this:
git@github.com:stuycs-gh-classrooms/nextcs-work-jonalf.git
- The link should look like this:
- Open a terminal, clone your repository into your home directory:
$ git clone SSH_LINK
(replaceSSH_LINK
with the link from step 2)
- Change into the cloned repository:
$cd REPOSITORY
(if you don’t know the name of your repository, tryls
).
Modify README.md & Commit Your Changes
- On your computer, open README.md in a text editor (do not use something like Microsoft Word or Apple Pages).
- On windows, use Notepad.
- On MacOS, use TextEdit.
- Directly below your name, add the following line:
updated from home!
- Save the file.
- Commit your changes from the terminal:
$ git commit -am "updated README from home"
- The message in
""
will be associated with this specific commit. It allows you to document what has changed.
- Push your commits from the terminal:
$ git push
- Go back to your repository on the GitHub website and refresh. You should see your updated file.