Not logged in. Login

Working with Git and GitHub

SFU GitHub will be used for the group work in this course. There are two pieces of technology in play here: GitHub with manages the repositories and permissions, and Git itself as a version control system.

Github Setup

Logging In to GitHub.sfu.ca

Sign in to the SFU GitHub server using the “SFU ID” option and your usual SFU username and password.

Set up an SSH key

You'll probably want to access the repository by SSH. If you don't already have an SSH key, you will need to generate one. This is easy on Linux (steps 1-3 there), or on a Mac. You'll have a little more work to do on Windows.

Once you have an SSH key, add the key in SFU GitHub.

Create a Project

One group member should create a project with visibility level “Private”.

You'll only be able to search for your group members after they have logged into the system at least once. (The system doesn't have a list of SFU users, so until someone logs in, it has no idea they exist.) So each group member will at least have to visit the site and log in first.

You can then add the other members of the group to the project: in the project, select “Settings”, “Members”, and “New project member”. You can search by userid and add them with “Developer” or “Master” project access levels.

Make sure you add the instructor and TA (sbergner, asa498, msw10, mba216) to the project as well.

Git Setup

There are a couple of commands you need to run to tell Git who you are, before starting work. Please use your SFU email address:

git config --global user.name "**Your Name**"
git config --global user.email "**userid**@sfu.ca"

Working on the Project

On the GitHub main project page, you will find the URL where you can clone the Git repository onto your computer. The command will be something like this:

git clone git@github.sfu.ca:your-sfuid/your-project.git

The project page itself gives more complete instructions for the first interactions with the repository: you get a very empty repository that requires some bootstrapping.

Working with Git

A Git manual is beyond the scope of this page, but here are the bare basics:

git pull                     # get changes from your group members
text_editor some/file.txt    # do some work
git add some/file.txt        # stage those changes for commit
text_editor other/file.txt   # do some more work
git add other/file.txt       # stage more changes for commit
git commit                   # commit the changes
git push                     # push to the remote server so others can see changes

Here are some Git tutorials for more information:

Project Repository Submission Guidelines

We require that your project Git repository be hosted on github.sfu.ca. This allows us to access the code for your work and review the commit history of your team members as you collaborate on the projects.

If your collaboration has begun on a public platform like github.com, please fork a copy of that repository onto the SFU server and grant access to the instructional team.

Steps to Mirror (or 'Fork') an Existing Repository to github.sfu.ca

  1. Navigate to github.sfu.ca and create an empty repo (do not include a README). We will refer to the resulting repository URL as `repo_url`.
  2. Ensure you have a local clone of your project repository, which includes the commit history. This repository's origin may be set to a non-SFU GitHub URL.
  3. Open your terminal and change directories to your local repository folder: cd path/to/your/repo
  4. Add the SFU GitHub server as a new remote to your local repository: git remote add sfugh https://github.sfu.ca/your/repo_url
  5. Push your main branch to the SFU GitHub server: git push sfugh main
  6. Visit your new repository on github.sfu.ca and add members of the instructional team to the repository.

Note: If your repository uses 'master' as the main branch, replace `main` with `master` in the push command above.

Alternative authentication using personal access tokens

If anyone is having issues with the above for mirroring your repo, e.g. if the sshkey is not set up, you can also get authenticated with a PAT token

  1. Follow the first three steps from the above procedure
  2. On your SFU GH account navigate to settings->Developer Settings ->Personal Access Tokens
  3. Generate a new token with respective scope
  4. In the new repo on github.sfu.ca grab https clone link
  5. Add sfu server in your local clone: git remote add sfugh https://<YOUR TOKEN>@github.sfu.ca/repo
  6. git push -u sfugh main
  7. Perform the last step of the above proceduce

See Also

Updated Fri April 12 2024, 16:10 by sbergner.