GitLab Sample Project#

This guide shows you how to create a first GitLab project and get it onto your local machine. For detailed Git tutorials, we recommend external resources listed at the bottom of this page.

Creating a Project#

  1. Login to GitLab

    Navigate to gitlab.surrey.ac.uk and login with your university credentials.

  2. Create a New Project

    • Click “New project”“Create blank project”

    • Fill in the project details:

      • Project name: “My Research Project”

      • Project description: Brief description of your research

      • Visibility level: Choose “Private” for research projects

      • Initialize repository with a README: ✓ Check this box

    • Click “Create project”

  3. Add Collaborators (Optional)

    • Go to Your Project → Manage → Members

    • Click “Invite members”

    • Enter your colleague’s university email or username

    • Click “Invite”

If your prospective collaborator is not a member of the university, please submit a Support Ticket to request a guest account for them.

Cloning Locally#

To get your project onto your local machine where you can work with it, first set up your SSH keys and then do the following:

  1. Get the Clone URL

    On your project’s main page, click “Clone” and copy the SSH URL:

    git@gitlab.surrey.ac.uk:your-username/my-research-project.git
    
  2. Clone the Repository

    Open a terminal and run:

    git clone git@gitlab.surrey.ac.uk:your-username/my-research-project.git
    cd my-research-project
    
  3. Verify the Clone

    ls -la
    git status
    

    You should see your README file and confirmation that you’re on the main branch.

That’s it! You now have a local copy of your GitLab project that you can work with.

Set Author Metadata#

Before you can commit (and push) changes to your repository, you need to set up some author metadata for Git. If you use Git with repos hosted in multiple platforms (e.g. GitLab and GitHub), it is advisable to set the author data only locally for each repo:

cd my-research-project
git config --local user.name ab1234   # replace ab1234 with your username
git config --local user.email YourSurreyEmail@surrey.ac.uk

Should you only use Surrey’s Gitlab instance and no other Git platform, you can set the author metadata globally:

git config --global user.name "ab1234"   # replace ab1234 with your username
git config --global user.email "YourSurreyEmail@surrey.ac.uk"

Pushing Changes#

After you made your changes let’s commit and push these changes to GitLab.

  1. Stage Your Changes

    Add the new or updated files to a new commit:

    # add all new / changed files at once. This may add files you do not wish to add
    git add .
    
    # alternatively, only add specific files, e.g.
    git add file1.txt file2.py file3.c test/script.py
    
  2. Commit Your Changes

    Create a commit with a descriptive message:

    git commit -m "Initial project structure and documentation
    
    - Added basic Python data processing script
    - Created project directory structure
    - Added comprehensive .gitignore
    - Updated README with project overview"
    
  3. Push to GitLab

    # pushes the commit to the main branch off the remote origin repo
    git push origin main
    
  4. Verify on GitLab

    Go back to your project page on GitLab to see your changes reflected in the web interface.

Tip

If you are not too familiar with git workflows, we recommend that you check out the Git Learning Resources, we have compiled here.

Please make use of the Available Support if you have questions or get stuck somewhere.

Possible Next Steps#

  1. Learn basic Git: Use the resources linked above to understand fundamental Git workflows

  2. Practice with your project: Add files, make commits, and push changes

  3. Explore GitLab features: Try issues, merge requests, and collaboration tools

  4. Create a project website: Learn about GitLab Pages