I do not plan to use email at all for communication, and will send all class annoucements via Slack. I encourage everyone to do the same. If you want to send me a private message, Slack has the option of a "direct message (DM)". You can DM me, or anyone else in the class. And you can create your own channels, which can be private, to which you can invite your team mates (for e.g. when team-working on a project! really cool feature!). I created three channels: #class (for all class communication and file sharing), #assignments (for all assignment-related communication), #general (for general announcements), and #random (for everything else).
Nothing to submit, just warmup. If you run into problems, post on Slack!
Nothing to submit. As always, if you run into problems, post on Slack!
Some of you may be familiar with Git and Github from csci2330: Systems. If so, go quickly over this section to refresh your memory and make sure you don't miss anything. If this is the first time you see Git, you may want to check out the detailed Git tutorial maintained by Sean Barker.
Git is an open-source, distributed version control software, initially developed by Linus Torvalds for Linux. GitHub implements a web-based version of git where users, in addition to using git commands, can store their repositories "into the cloud". GitHub offers all the functionality of git plus extra features (like wiki pages for each project; networking features like feeds and followers). GitHub has 20+ million users, and it's become a virtual meeting place for software developpers, for sharing information and showcasing projects.
How it works, in a nutshell: With Github you and your peers can work together on projects from anywhere in the world. Initially you (or someone else) will create a remote master repository for your project. This master repository is hosted remotely, on github. You (and your partners, if any) will then clone (checkout) a private copy of the remote master repository on your local machine. You can clone several copies of the master repo in several locations, if you want. You can make changes to your local copy. When you are done, you stage these changes for commit, and then you push them to the master repository. Once your changes are pushed to the master repo, your partners can get them by "pulling" the changes from the master repo into their local repo. Git automatically merges the changes pulled form the master with the local changes in the local repo. Git keeps a record of all changes, and any change can be reverted.
To start, create a Github account, if you don't have one already. Before you starting using the Git command on the command line, you need to give it a basic configuration. This will tell Git who you are, making it easy for you and your partners to identify who committed code to your shared repository. Replace the email and name strings with your email address and name. If you have not run these commands, then the very first Git commit will fail and tell you to run them.
git config --global user.email "username@bowdoin.edu" git config --global user.name "Your Name" git config --global push.default simple
To authenticate using an SSH-key, a user must have an SSH-key pair on their local computer. An SSH-key consists of a private key and a public key. The public key can be shared with anyone, and the private key needs to be kept confidential (just like a password).
How it works:
Setting up SSH-key authentication in Github:
ssh-keygen -t rsa -b 4096 -C "youremail@bowdoin.edu"This uses the RSA algorithm and creates a new public/private SSH key pair on your computer, using the provided email as a label. When it prompts you to enter a file to save the key, press Enter to accept the default. AT the next prompt, type a secure passphrase. A passphrase should be hard to guess, have at least 15 characters, contain a combination if letters and diGits and punctuation characters.
This has generated an RSA SSH key pair, located in the .ssh hidden directory in your home directory. These files are:
~/.ssh/id_rsa <------------ the private key. DO NOT SHARE!!! ~/.ssh/id_rsa.pub <--------- the associate public key. This can be shared freely
Host github.com AddKeysToAgent yes UseKeychain yes IdentityFile ~/.ssh/id_rsaIf you had to create your SSH config file, you'll also need to set the file permissions appropriately:
chmod 600 ~/.ssh/config
cat ~/.ssh/id_rsa.pubPaste the output of that command (using your actual filename) into the Key field of the GitHub settings page, then click Add SSH key.
git@github.com:lauratoma/helloworld.gitFirst you will go to the path where you want to place your local directory. For example, I have a directory called CompGeom on my Desktop:
cd ~/Desktop/CompGeomNow clone it:
git clone git@github.com:lauratoma/helloworld.gitThis will create a folder called helloworld, with a file hello.c inside it.
cd helloworld ls hello.c README.mdOnce cloned, the usual work cycle in Git is pull-add-commit-push:
cd ~/Desktop/helloworld git pullNow your local repo is sync-ed with the master repo.
git statusthis will show you what files are modified. Now stage the files that you want to commit. For example let's say you modified hello.c. You'll want to stage it:
git add hello.cNote: You should never add object files (.o files) and executables to the repo.
git commit -m "describe what the changes represent"Note that commit does not take file names as arguments, and will update the local repo with the files that have been staged. Files that have not been specifically staged for commit, will not be commited.
git push
There are more advanced featured of git which you may or may not need later, like branching, resolving merge conflicts, reversing changes, deleting files, and more ---- we'll figure those out later when the need arises. For now these basics commands will suffice.