The web address is https://github.swarthmore.edu. You should be able to log in with your typical Swarthmore credentials (the same username / password you use for email). Upon logging in, you should see a welcome page that lists the repositories you currently own.
For CS 31, we'll be using a feature of GitHub called "organizations", which allows us to control everything for the course. The organization this semester is named CS31-s16. From the main GitHub page, you can select the organization you want to use, or you can jump directly to the CS31-s16 organization.
On the organization page, you should see a list of repositories that you can access. The repositories will be named according to what they contain and which users can access them. For example, suppose two teammates (Sterling Archer, sarcher1, and Lana Kane, lkane1) are working together. When Lana accesses the organization, she would expect to see:
With git, you and your partner both create a local copy ("clone") of the shared repository, make and commit changes locally, and push the changes back to GitHub, where your partner can retrieve them.
Click on a repository, and it'll take you to a page that lists its contents (and many other useful things). One the lower right hand side, you'll see some text that says "You can clone with HTTPS, SSH, or Subversion". Click the "SSH" link. This will give you a link that you can use to clone. Let's first enter our cs31 directory and make the clone there:
cd cd cs31/labs
From here, you can use git clone [URL] to locally clone the repository, where [URL] is the SSH URL given to you by GitHub. For example, if Lana were cloning, she might use: "git clone git@github.swarthmore.edu:CS31-s16/Lab1-lkane1-sarcher1.git". You can now cd into your repository directory and access the files there.
If you get authentication errors, make sure you've uploaded an SSH key to your GitHub account. (See: one-time configuration steps)
At this point, you now have a master git repository for your project that only you, your partners, and graders/instructors can access. All changes, additions, deletions, to this project can be done with git commands that will push and pull changes from this remote master copy.
You and your partner will work in your local private copies of the repo. You can add and commit changes to your private copy as you go, and choose when to push your change to the remote master repo. Once you push changes, your instructor or partner can then pull from the remote master into their copy.
An example of a sequence of common git commands:
# check the status of your repo $ git status # see the changes to the file (compared to your last local commit): $ git diff blah.c # add a new file to the repo on the next commit: $ cp ~/private/foo.c . $ git add foo.c # or add new changes to an existing repo file to the next commit: $ vi blah.c # edit with your favorite editor $ git add blah.c # commit your changes (adds and deletes) to your local repository: $ git commit # push committed changes from your local to the remote master repository # note: the first time you push, you may need to do: # git push origin master $ git push # your partner can now pull your changes from the remote into their local: $ git pull
git add foo.c blah.c # add two specified files git add # add all files except those in .gitignore file git add *.c # add all files with .c suffix
*.o myprog *.swpYou add a .gitignore file to a git repo just like you add any other file:
git add .gitignore git commit git push
git help # list common git commands git help --all lists all commands git add # add changes or new files to the next commit git rm # remove a file at the next commit git commit # commit your changes to your local repository git push # push your committed changes to the remote master repository # (note: the first time you may have to do: push origin master git pull # pull changes pushed to remote master into your local copy # (git will try to merge changes into your copy) git mv # move a repo file git diff # see a diff between a file(s) and latest commit (local repo) git diff master origin/master # diff between your copy and master's git status # see what has changed between your copy and the master version git branch -a # see all the branches (likely only master)
git config --global user.email "you@example.com" git config --global user.name "Your Name"
git push -u origin masterSubsequent calls to git push should work (i.e. you should not need to include origin master after this first time).
<<<<<< my local version changes |||||| common ancestor version ====== remote version changes that I'm trying to pull into mine >>>>>>In your editor, search for these symbols and fix the code by hand. Then add and commit your fixed version and run git pull again.