Skip to content

CS GitLab (git.cs.odu.edu)

The CS Systems Group hosts a GitLab instance at git.cs.odu.edu. This service provides a comprehensive platform for version control, collaboration, and software development lifecycle management for CS students and faculty.

Public Content

git.cs.odu.edu is a public-facing platform. It is recommended to set all repositories to private upon creation to avoid unintentional publication. Students are responsible for any content they may publish.


What is Git?

Git is a powerful, free, and open-source distributed version control system (DVCS). It's designed to handle everything from small to very large projects with speed and efficiency. Git allows multiple developers to work on a project simultaneously without overwriting each other's changes.

  • Branching and Merging: Easily create separate lines of development (branches) and merge them back into the main project.
  • Tracking History: Every change is tracked, allowing you to revert to previous versions if needed.
  • Distributed Nature: Every developer has a full copy of the project history on their local machine, enabling offline work and robust backup.
GitLab (git.cs.odu.edu) vs. GitHub

While both GitLab and GitHub are web-based platforms that provide hosting for Git repositories, there are some key distinctions, especially when comparing a self-hosted instance like git.cs.odu.edu to the public GitHub.com.

  • GitHub.com:

    • An industry-standard, commercially owned platform.
    • Offers a free tier, including unlimited private repositories for individuals and organizations, with some limitations on features like Actions minutes and Pages.
    • Advanced features, extensive CI/CD resources, and enterprise-grade security often require paid subscriptions.
  • GitLab (as self-hosted on git.cs.odu.edu):

    • git.cs.odu.edu is an instance of GitLab managed by the Systems Group.
    • Unified DevOps Platform: GitLab provides an integrated solution for the entire software development lifecycle, including source code management, issue tracking, powerful CI/CD (Continuous Integration/Continuous Delivery), and a container registry (registry.cs.odu.edu).
    • CS Account Integration: You can log in using your standard CS department credentials (e.g., cs_jdoe001).
    • Feature Availability: Self-hosted GitLab instances like ours can offer a comprehensive set of features to all users that might be part of premium tiers on services like GitHub.com or GitLab.com (e.g. Pages). This provides a rich development environment for academic and research projects.

Getting Started

Logging In

To access git.cs.odu.edu:

  1. Navigate to https://git.cs.odu.edu in your web browser.
  2. You should be presented with a login page. Use your CS account username (e.g., cs_jdoe001) and password.

Setting Up SSH Keys

SSH keys provide a secure way to interact with your Git repositories without needing to enter your username and password every time.

  1. Generate a SSH key: If you don't have an SSH key, generate one:

    ssh-keygen -t ed25519 -C "your_email@odu.edu"
    

    Press Enter to accept the default file location and passphrase (entering a passphrase is recommended).

  2. Add your SSH public key to GitLab:

    • Copy your public key to the clipboard.

      If you generated an ed25519 key with default name:

      cat ~/.ssh/id_ed25519.pub
      
      Select and copy the entire output. * Go to git.cs.odu.edu. * Click on your avatar in the top left corner and select Edit profile. * In the left sidebar, click on SSH Keys. * Click Add key. * Paste your copied public key into the "Key" field. * Give it a descriptive "Title" (e.g., "My Laptop"). * Click Add key.

Creating a New Project (Repository)

  1. On the git.cs.odu.edu dashboard, click the "+ New project" button (top left).
  2. Select "Create blank project".
  3. Project name: Enter a name for your project (e.g., my-awesome-app).
  4. Project slug: This will be automatically generated based on the project name and is part of the project's URL.
  5. Visibility Level:
    • Private: Only you and members you explicitly add can see and access the project. (Recommended for most coursework unless specified otherwise).
    • Internal: Any logged-in user on git.cs.odu.edu can see the project.
    • Public: The project is visible to anyone on the internet (use with caution).
  6. Uncheck "Initialize repository with a README" if you plan to push an existing local repository. If it's a brand new project, keeping it checked is helpful.
  7. Click "Create project".

Pushing to Your Repository

Once your project is created, you can push code to it from your local machine.

  1. Clone the repository (if you created an empty one on GitLab): On your project's main page on git.cs.odu.edu, click the "Clone" button and copy the "Clone with SSH" URL (e.g., git@git.cs.odu.edu:your_cs_username/my-awesome-app.git). In your terminal:

    git clone git@git.cs.odu.edu:your_cs_username/my-awesome-app.git
    cd my-awesome-app
    

  2. Or, for an existing local project, add GitLab as a remote: Navigate to your existing project's directory in the terminal:

    cd path/to/your/existing-project
    git remote add origin git@git.cs.odu.edu:your_cs_username/my-awesome-app.git
    git branch -M main
    git push -u origin main
    

  3. Add, Commit, and Push files:

    • Create or modify files in your project directory.
      echo "# My Awesome App" > README.md
      
    • Add the files to staging:
      git add .  # Adds all new and modified files
      # Or specify individual files: git add README.md
      
    • Commit the changes with a descriptive message:
      git commit -m "Initial commit with README"
      
    • Push your changes to git.cs.odu.edu:
      git push -u origin main
      
      (The -u origin main part sets the upstream branch for future pushes, so next time you can just use git push).

Pushing to Your Project's Container Registry

git.cs.odu.edu includes an integrated Docker container registry at registry.cs.odu.edu. This allows you to build and store Docker images alongside your code.

Prerequisites:

  • Docker installed on your local machine or where you are building the image.
  • A Dockerfile in your project's root directory.

Steps:

  1. Log in to the Container Registry: You'll need to use your CS username. For the password, it's best to use a Personal Access Token with read_registry and write_registry scopes, or a Deploy Token if you're automating this in CI/CD. You can create Personal Access Tokens under Edit profile -> Access Tokens on git.cs.odu.edu.

    docker login registry.cs.odu.edu
    # Username: your_cs_username (e.g., cs_jdoe001)
    # Password: <your_personal_access_token>
    

  2. Build your Docker image: Navigate to your project directory (where the Dockerfile is). The image name should follow the pattern: registry.cs.odu.edu/your_cs_username/your_project_slug/your_image_name:tag For example:

    docker build -t registry.cs.odu.edu/cs_jdoe001/my-awesome-app/my-app:latest .
    # Or, if your project is under a group:
    # docker build -t registry.cs.odu.edu/group_name/my-awesome-app/my-app:latest .
    

    • your_cs_username: Your CS GitLab username.
    • your_project_slug: The slug of your project on git.cs.odu.edu.
    • your_image_name: A name for your image (can be the same as project_slug or more specific).
    • tag: A version tag (e.g., latest, v1.0).
  3. Push your Docker image:

    docker push registry.cs.odu.edu/cs_jdoe001/my-awesome-app/my-app:latest
    

After pushing, your image will be available in your project's Deploy -> Container Registry section on git.cs.odu.edu.


Common Questions or Issues

SSH: Permission denied (publickey) when trying to clone or push

This typically means your SSH key is not set up correctly with git.cs.odu.edu. * Ensure you have generated an SSH key pair. * Verify that your public key (e.g., id_ed25519.pub or id_rsa.pub) has been added to your GitLab profile under Edit profile -> SSH Keys. * Ensure your SSH agent is running and has your private key loaded, especially if your key has a passphrase. You might need to use ssh-add ~/.ssh/your_private_key_file. * Double-check the SSH URL you are using for your repository (git@git.cs.odu.edu:... not https://...).

Authentication failed for registry.cs.odu.edu

When using docker login registry.cs.odu.edu: * Ensure you are using your correct CS username (e.g., cs_jdoe001). * Using a Personal Access Token (PAT) or Deploy Toekn is highly recommended for the password. Create a PAT on git.cs.odu.edu under Edit profile -> Access Tokens with read_registry and write_registry scopes. Using your main CS account password is not supported outside the CS network.


If you encounter other issues or have questions specific to the git.cs.odu.edu service, please contact the CS Systems Group at root@cs.odu.edu.