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
:
- Navigate to https://git.cs.odu.edu in your web browser.
- 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.
-
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).
-
Add your SSH public key to GitLab:
-
Copy your public key to the clipboard.
If you generated an
ed25519
key with default name:Select and copy the entire output. * Go tocat ~/.ssh/id_ed25519.pub
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)
- On the
git.cs.odu.edu
dashboard, click the "+ New project" button (top left). - Select "Create blank project".
- Project name: Enter a name for your project (e.g.,
my-awesome-app
). - Project slug: This will be automatically generated based on the project name and is part of the project's URL.
- 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).
- 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.
- Click "Create project".
Pushing to Your Repository
Once your project is created, you can push code to it from your local machine.
-
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
-
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
-
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
:(Thegit push -u origin main
-u origin main
part sets the upstream branch for future pushes, so next time you can just usegit push
).
- Create or modify files in your project directory.
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:
-
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
andwrite_registry
scopes, or a Deploy Token if you're automating this in CI/CD. You can create Personal Access Tokens underEdit profile
->Access Tokens
ongit.cs.odu.edu
.docker login registry.cs.odu.edu # Username: your_cs_username (e.g., cs_jdoe001) # Password: <your_personal_access_token>
-
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 ongit.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
).
-
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
.