This lesson is in the early stages of development (Alpha version)

Creating the remote repository

Overview

Teaching: 10 min
Exercises: 15 min
Questions
  • How do I create a repository and share code?

Objectives
  • Upload your simple readme file

This episode assumes

  • You’ve uploaded your public key to gitlab and verified that it’s working

In this episode we’ll finally push something to a public gitlab repository.

Creating an empty repository on gitlab

Go to gitlab.cern.ch and click the little “plus” dropdown icon near the center of the top bar, and select “New project”.

This will bring you to a dialog page to create the project. The important fields are:

The “project description” might be useful, but in general this should be explained in the README.

Click the “Create Project” button on the bottom. You should be presented with a page that gives the name of the project and says “The repository for this project is empty”.

Make sure you keep track of the URL for this page: this is where your public code will live from now on.

Pushing your local project

On the empty project page there are instructions to push an existing project. Unfortunately CERN uses a much more complicated authentication scheme than ssh by default, so these can be confusing.

Click the blue “clone” button on the upper right side of the page. It will give you multiple options, click the “copy URL to clipboard” button next to “Clone with SSH”.

Now you need to go back to your terminal and tell your local repository that a remote repository lives at this URL.

git remote add origin ssh://git@gitlab.cern.ch:7999/rest/of/url.git

where the last string starting with ssh://… is the URL you just copied.

Now try pushing your local project!

git push -u origin master

Once this is done, refresh the browser in your gitlab page. You should see your README now!

Notes

  1. Note that while our code is public by default, and you should feel free to create public documentation in the twiki sandbox or by adding twikis to your gitlab repositories. Our physics documentation is internal until approved. Within the physics repositories we use LDAP to periodically synchronize the gitlab user list with e-groups. The procedure is slow error-prone so we won’t discuss it here. 

Key Points

  • Initializing a new repository is very easy

  • Share your code as appropriate