Working with Git at uOttawa

Git is a version control tool for source code. This page does not cover the details of how to use git, only useful commands that you may need to know while working with our team. If you are new to Git, we recommend you read some of the documentation on their website before proceeding.

Getting Started with Git

These instructions will get you up and running with Git. You should only need to run them once per computer you use.

Configure your identity

Start by opening Terminal/Cygwin and running the following commands, replacing the information with your own. This will tell Git who you are and allow us to determine who made what changes.

git config --global "Jane Smith" git config --global ""

Create a public key

Still in Terminal/Cygwin, run the following commands to create a public key pair to use to communicate securely with our servers. Replace the email address with your own

ssh-keygen -t rsa -C "" # When prompted for a file name, enter "uottawa_gitlab". cp ~/.ssh/ ~/

Configure your GitLab account

Next, you will need to create and configure your GitLab account. GitLab is the software that allows us to share Git repositories with each other.

  • Login to uOttawa's GitLab server using your Exchange username and password (the same credentials you use for your email).
  • Click on the small person icon that says "Profile settings" when you hover over it, in the top right-hand corner.
  • Click on the link in the left-hand navigation that says "SSH Keys".
  • Click on the green button that says "+ Add SSH Key" in the top right-hand corner.
  • For the Title, you can enter whatever you want - we suggest something like "Jane's Workstation".
  • For the Key, open the file in your home directory named (if you are on Windows, this will be in your cygwin home directory, usually located under C:\cygwin\home\) and copy the contents of the file into the text area control.
  • Click "Add Key".

Request project access

Email Bryan Miller, requesting access to the uoWeb project.

Configure your system

Back in terminal, run the following commands to configure an SSH host entry for GitLab.

cd ~/.ssh vim config # enter the following text, then save and exit. Host gitlab User git Hostname Port 22 IdentityFile ~/.ssh/gitlab ssh -T gitlab # Enter "yes" whne prompted with the RSA fingerprint # You should then see a message saying "Welcome to GitLab, Jane Smith"

Configure your global gitignore file that Git uses it to determine which files and directories to ignore, before you make a commit. Open up a terminal amd run the following commands.

cd ~ vim .gitignore # copy the following text, then save and exit. ":wq" ### NetBeans ### # Ignore paths that contain user-generated content nbproject/* build/ nbbuild/ dist/ nbdist/ nbactions.xml/ nb-configuration.xml .nb-gradle/ ### Drupal Config ### # Ignore configuration files that may contain sensitive information. sites/*/settings*.php sites/*/files sites/*/private ### Vim ### *~ *.swp *.swo ### OSX ### .DS* .AppleDouble .LSOverride # Hidden files .project # Temporary files tmp* # Icon must end with two \r Icon # Thumbnails ._* # Files that might appear in the root of a volume .DocumentRevisions-V100 .fseventsd .Spotlight-V100 .TemporaryItems .Trashes .VolumeIcon.icns # Directories potentially created on remote AFP share .AppleDB .AppleDesktop Network Trash Folder Temporary Items .apdisk ### Windows ### # Windows image file caches Thumbs.db ehthumbs.db # Folder config file Desktop.ini # Recycle Bin used on file shares $RECYCLE.BIN/ # Windows installer files *.cab *.msi *.msm *.msp *.bat # Windows shortcuts *.lnk # Misc *.bak .LCK* # Enter this command to initialize the ignore file. git config --global core.excludesfile '~/.gitignore'



Within uoWeb, there are many different repositories. Each repository contains a major module, some of which may contain other modules. It has been organized this way to allow for easy redistribution of just a part of uoWeb.

Once you have created a local build, you can find these repositories located in the following locations:

This is the installation profile that manages how Drupal is installed for our distribution.
This directory contains the custom themes that control the look & feel of the site.
This directory contains modules that we have created and are considering sharing to the community.
This directory contains modules that provide a new content type or other type of bundle to Drupal.
This directory contains modules that provide a new front-end widget for Drupal.
This directory contains modules that provide extra configuration for certain use cases or environments.
This directory contains modules that provide example content and Selenium test cases.


Each project has a series of branches that are used for the release process. These eight branches are each tied to a stage in the continuous deployment workflow; generally, developers will not need to touch these branches unless they are preparing a hotfix late in the release cycle. Other branches can be created as well by developers, when working on a change.

This contains the latest code that has passed the code review process. It should be fairly stable but it has not yet been automatically tested.
This is a copy of the master branch that is made before we begin testing, to ensure that the code does not change between testing and updating the stable branch.
This branch contains the latest version of master that has been through the hourly testing routine.
This branch is built nightly and contains a more thoroughly tested version of the stable branch.
This branch contains the code that is currently used on the QA environment's example site - this site will be used for accessibility testing and similar use cases that require a fully built site with a static URL.
This branch contains the code that is currently used in the QA environment.
This branch contains the code that is currently used on the Production and Authoring environments' example sites.
This branch contains the code that is currently used in the Production environment.

Useful Git Commands

This section contains some useful Git commands that you might need to use sometimes.

# Use this command if you want to checkout somebody else's work. git fetch --all gitlab # Replace WEB-0000_jsmith with the name of the branch you want to view or work from. git checkout WEB-0000_jsmith # This command removes all uncommitted changes from the current repository. # Use this if you want to get rid of ALL your changes PERMANENTLY. git reset --hard # This command removes the file from git AND the filesystem. You must use this # to delete the file from the repository. git rm filename # This command removes the file from git but leaves it in the file system. Use # this if you want to remove the file from the repository but keep it locally. git rm --cached filename # Shows the commit history for the current repository. You can get the commit IDs here. git log # Saves your changes to a temporary place git stash # Shows you a list of stashed changes git stash list # Applies a set of stashed changes git stash apply stashid
» Submit feedback
  • Developers
  • Getting Started
  • Tools
Back to top