lab 25 Distributed workflow (1/4)

Goals

You need to work in pairs to complete the next four labs. One of you (let's call her/him Alex) will be the integration manager, i.e. the one who is in charge of the official repository. This repository will also be called the "blessed" or "upstream" repository. The other member of the pair will play the role of one of the developers who contributes to the project. Let's call her/him "Dany".

In the next two labs, we will build the following working environment.

The two public repositories (first row on the image above) will be created using the web-based repository manager GitLab available here at Ensicaen: https://gitlab.ecole.ensicaen.fr. The two private repositories will be obtained by cloning their public counterpart on the local file-system.

Setting up Alex's public repository 01

Alex should login into the GitLab manager, and create a project called "tp-git". Be careful: you should create an "internal" repository so that any user authenticated with this gitlab server has read access using https.

Once you are done, the repository should be available at the URL:

  • https://gitlab.ecole.ensicaen.fr/alex/tp-git.git

Configuring a pair of SSH keys for GitLab 02

In order to be able to push data on the GitLab server, you need to create a pair of SSH keys and to provide GitLab with your public key. For that purpose, follow the instructions given here. The public key should be added in your profile settings here.

Setting up Alex's private repository 03

We create Alex's private repository by cloning his public one.

Execute:

git clone git@gitlab.ecole.ensicaen.fr:alex/tp-git.git
cd tp-git

Output:

$ git clone git@gitlab.ecole.ensicaen.fr:alex/tp-git.git
Cloning into 'tp-git'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.
$ cd tp-git

Pushing a first commit 04

Alex can now create a first file in the project, commit, and push it to the blessed repository. Note that cloning automatically creates an "origin" remote in the resulting repository.

We create a "main.c" file in the "tp-git" working directory.

File: main.c

#include <stdio.h>
int main()
{
  return 0;
}

We commit and push to the public repository.

Execute:

git add main.c
git commit -m "Add main.c"
git push -u origin master

Output:

$ git add README
$ git commit -m "Add Main.c"
[master (root-commit) 25d99ab] Add README
 1 file changed, 1 insertion(+)
 create mode 100644 main.c
$ git push -u origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 242 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@gitlab.ecole.ensicaen.fr:alex/tp-git.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.
$

Setting up Dany's repositories 05

Dany may now create her/his own repositories by following steps 01 to 03 above.

IMPORTANT: When creating her/his public repository on GitLab (step 01), Dany should "import" the content of Alex's public repository:
 — Use the "New project" button, then open "Import project" tab, and press the "Repo by URL" button, then paste the URL of the blessed repository.
 — You need to use the full URL (including the .git" extension) and provide the username and password of your Linux/Windows account.