|
|
Assignments files for the lecture "Algorithms and Datastructure" 2014
|
|
|
=================================================================
|
|
|
# Assignments files for the lecture "Algorithms and Datastructure" 2014
|
|
|
|
|
|
You can use this repository as "upstream" to your workspace to simplify the
|
|
|
setup for each assignment.
|
|
|
## First use of git
|
|
|
|
|
|
1) Start Eclipse
|
|
|
----------------------------
|
|
|
* Just start Eclipse as usual.
|
|
|
### 1) Create your own remote repository in gitlab
|
|
|
|
|
|
2) Generate a SSH key pair (optional)
|
|
|
-------------------------------------------------
|
|
|
Note: You can skip this step if you already have a SSH key pair or if you
|
|
|
prefer to use the HTTPS protocol.
|
|
|
You need one remote repository per team. So if you work as a team, **only one
|
|
|
student has to do this step**.
|
|
|
|
|
|
* Open the "Preferences" menu of Eclipse and navigate to
|
|
|
`General -> Network Connections -> SSH2`
|
|
|
* Choose the "Key Management" tab.
|
|
|
* Generate a key RSA key.
|
|
|
* Copy your public key as a new key in
|
|
|
[gitlab -> My profile -> SSH Keys](https://forge.tic.eia-fr.ch/git/keys)
|
|
|
* Protect your private key with a good pass-phrase and save it.
|
|
|
|
|
|
3) Create your own remote repository
|
|
|
------------------------------------------------
|
|
|
* Point your web browser to [the forge](https://forge.tic.eia-fr.ch/git/])
|
|
|
* Choose the tab "Projects"
|
|
|
* Click on "+ New Project"
|
|
|
* Name your project "tp-algo1-2014" in your own name space
|
|
|
* Click on "Create project"
|
|
|
* Copy the URI of your project
|
|
|
(it should be `https://forge.tic.eia-fr.ch/git/user.name/tp-algo1-2014.git`
|
|
|
if you use HTTPS and `git@forge.tic.eia-fr.ch:user.name/tp-algo1-2014.git`
|
|
|
if you use SSH)
|
|
|
(it should be `https://forge.tic.eia-fr.ch/git/user.name/tp-algo1-2014.git`).
|
|
|
|
|
|
### 2) Add the teacher, the assistant, and your co-worker to your
|
|
|
repository
|
|
|
|
|
|
4) Add the teacher and the assistant as reporter to your repository
|
|
|
-------------------------------------------------------------------------------
|
|
|
* Select your project and navigate to `Settings -> Project Members`
|
|
|
* Add the teacher and assistant as a "Reporter"
|
|
|
* If you work in a team, you can also add your co-worker as a "Developer"
|
|
|
* If you work in a team, also add your co-worker as a "Developer"
|
|
|
|
|
|
### 3) Clone your remote gitlab repository
|
|
|
|
|
|
**Every member of the team should do this step!**
|
|
|
|
|
|
5) Clone your remote gitlab repository
|
|
|
--------------------------------------------------
|
|
|
* Switch back to Eclipse.
|
|
|
* Start Eclipse.
|
|
|
* Open the "Git perspective":
|
|
|
`Window -> Open Perspective -> Other... -> Git Repository Exploring`.
|
|
|
* A new "git" icon should appear in the upper right corner of your window.
|
|
|
* Click on he icon that says
|
|
|
"Clone a Git Repository and add the clone to this view".
|
|
|
* Set URI to `https://forge.tic.eia-fr.ch/git/user.name/tp-algo1-2014.git`
|
|
|
if you use HTTPS or `git@forge.tic.eia-fr.ch:user.name/tp-algo1-2014.git`
|
|
|
if you use SSH with a private/public key.
|
|
|
* Set URI to `https://forge.tic.eia-fr.ch/git/user.name/tp-algo1-2014.git`.
|
|
|
* For HTTPS, set the "User" and "Password" according to your school credentials.
|
|
|
* Accept the defaults values and click on "Next >".
|
|
|
* If you are using SSH, the system might ask for the pass-phrase. If so, give
|
... | ... | @@ -58,8 +41,10 @@ the pass-phrase that you used to protect your private key. |
|
|
* Set the field "Directory" with the path where you want to save the repository.
|
|
|
* Click on "Finish".
|
|
|
|
|
|
6) Add the upstream repository
|
|
|
------------------------------------------
|
|
|
### 4) Add the upstream repository
|
|
|
|
|
|
Here you will add the teacher's repository. At least one team member has to do
|
|
|
this step, but this is also OK if all team members do this step.
|
|
|
|
|
|
* Open the details of your repository by double-clicking on it.
|
|
|
* Right-click on "Remotes".
|
... | ... | @@ -67,8 +52,7 @@ the pass-phrase that you used to protect your private key. |
|
|
* Set the "Remote name" to `upstream`.
|
|
|
* Leave the selection on "Configure push" and click "OK".
|
|
|
* Set the URI to the one of your repository
|
|
|
(`https://forge.tic.eia-fr.ch/git/sup-algorithms/tp-algo1-2014.git`
|
|
|
or `git@forge.tic.eia-fr.ch:sup-algorithms/tp-algo1-2014.git`).
|
|
|
(`https://forge.tic.eia-fr.ch/git/sup-algorithms/tp-algo1-2014.git`).
|
|
|
* Click on "Save and Push".
|
|
|
* Right-click on "upstream" and choose "Configure Fetch...".
|
|
|
* Click "Advanced...".
|
... | ... | @@ -76,12 +60,14 @@ or `git@forge.tic.eia-fr.ch:sup-algorithms/tp-algo1-2014.git`). |
|
|
* Click "Finish".
|
|
|
* Click "Save".
|
|
|
|
|
|
Now "origin" iy **your** repository where you save your work and "upstream"
|
|
|
Now "origin" is **your** repository where you save your work and "upstream"
|
|
|
is the **teacher's repository** where you will find the initial files for
|
|
|
the assignments.
|
|
|
|
|
|
7) Create your first Java project for this lecture
|
|
|
--------------------------------------------------------------
|
|
|
### 5) Create your first Java project for this lecture
|
|
|
|
|
|
This step and the following must be done by all team members.
|
|
|
|
|
|
* Open the "Java perspective".
|
|
|
* Create a new Java project `File -> New -> Java Project`.
|
|
|
* Uncheck "use default location".
|
... | ... | @@ -89,28 +75,47 @@ the assignments. |
|
|
repository (.../git/tp-algo1-2014/s01).
|
|
|
* Click on "Finish"
|
|
|
|
|
|
8) Add the "git" menu to your Java perspective
|
|
|
----------------------------------------------------------
|
|
|
### 6) Add the "git" menu to your Java perspective
|
|
|
|
|
|
* Click on `Window -> Customize Perspective...`.
|
|
|
* Open the "Command Groups Availability".
|
|
|
* Check "Git" and "Git Navigation Action"
|
|
|
|
|
|
9) Solve the assignment
|
|
|
-----------------------------------
|
|
|
### 7) Solve the assignment
|
|
|
|
|
|
* Edit the files to solve the assignment and save your file
|
|
|
* Commit often your changes to your local repository
|
|
|
(using the "Commit changes" icon of your menu bar)
|
|
|
* Push your changes to the "origin"
|
|
|
|
|
|
10) At the beginning of each new assignment, fetch the "upstream"
|
|
|
----------------------------------------------------------------------------
|
|
|
|
|
|
## Next assignment
|
|
|
|
|
|
### 1a) At the beginning of each new assignment, fetch the "upstream"
|
|
|
|
|
|
This step must be done by **one team member** only (one with the remote
|
|
|
"upstream" configured).
|
|
|
|
|
|
* Open the "Git perspective":
|
|
|
`Window -> Open Perspective -> Other... -> Git Repository Exploring`.
|
|
|
* Open the "Remotes" section of the repository "tp-algo1-2014"
|
|
|
* Right-Click on "upstream" and choose "Fetch"
|
|
|
* Update your own repository: right-Click on "origin" and choose "Push"
|
|
|
|
|
|
|
|
|
### 1b) For all other team members, fetch the team repository
|
|
|
|
|
|
**This step must be done if you are not the one who did the previous step.**
|
|
|
|
|
|
* Open the "Git perspective":
|
|
|
`Window -> Open Perspective -> Other... -> Git Repository Exploring`.
|
|
|
* Open the "Remotes" section of the repository "tp-algo1-2014"
|
|
|
* Right-Click on "origin" and choose "Fetch"
|
|
|
|
|
|
### 2) Create the new project and solve the next assignment
|
|
|
|
|
|
This step must be done by all team members.
|
|
|
|
|
|
11) Create the new project and solve the next assignment
|
|
|
-------------------------------------------------------------------
|
|
|
* Open the "Java perspective".
|
|
|
* Create a new Java project: `File -> New -> Java Project`.
|
|
|
* Uncheck "use default location".
|
... | ... | @@ -119,4 +124,30 @@ repository (.../git/tp-algo1-2014/s01). |
|
|
* Click on "Finish".
|
|
|
* Edit the files to solve the assignment and save your file.
|
|
|
* Commit often your changes to your local repository.
|
|
|
* Push your changes to the "origin". |
|
|
\ No newline at end of file |
|
|
* Push your changes to the "origin".
|
|
|
|
|
|
## Using git with SSH instead of HTTPS
|
|
|
|
|
|
You will learn here how to generate a cryptography key pair and use it with git.
|
|
|
You don't need this to work the the gitlab of the school.
|
|
|
|
|
|
### 1) Generate a SSH key pair
|
|
|
|
|
|
Note: You can skip this step if you already have a SSH key pair or if you
|
|
|
prefer to use the HTTPS protocol.
|
|
|
|
|
|
* Open the "Preferences" menu of Eclipse and navigate to
|
|
|
`General -> Network Connections -> SSH2`
|
|
|
* Choose the "Key Management" tab.
|
|
|
* Generate a key RSA key.
|
|
|
|
|
|
### 2) Install your public key in gitlab
|
|
|
|
|
|
* Copy your public key as a new key in
|
|
|
[gitlab -> My profile -> SSH Keys](https://forge.tic.eia-fr.ch/git/keys)
|
|
|
* Protect your private key with a good pass-phrase and save it.
|
|
|
|
|
|
### 3) Use git in your URI
|
|
|
|
|
|
* Instead of the URI: `https://forge.tic.eia-fr.ch/git/...` now you can use
|
|
|
`git@forge.tic.eia-fr.ch:...`). |