Skip to content

2. Project Management

GIT and Web development

Assignment

Work through a git tutorial

Build a personal site describing you and your final project

Upload it to the class archive

Prior knowledge

Before starting the Fabacademy, I didn’t have any knowledge about coding, web or how create a personal webpage. I had to install a lot of new programs (code text editor) and find one that were already in my laptop!

Install Git on Windows

First thing to do: install Git on my computer in order to start using it. The integrated development environment (IDE) that we’ll use, as Windows user, will be Gitbash.

Git is, basically, a software for tracking changes in a set of files. It is used to coordinate the work between programmers who collaboratively develop some source code.

Gitbash

Git Bash is a source control management system for Windows. It allows users to type Git commands that make source code management easier through versioning and commit history.

drawing

Switching to Windows Powershell

Before even downloading and installing Git, together with our instructor Antonio we began to see some command lines to move through the computer directories. While my colleagues, Mac users, used Bash, I decided to switch to using Windows Powershell. Powershell is a Windows-native shell program that is much more powerful than bash (the actual shell in Git Bash), harder to learn but more sophisticated. At first I had some problem with the commands but Antonio kindly sent me this [tutorial] (https://mathieubuisson.github.io/powershell-linux-bash/) to find equivalents from Bash. When I installed Git and Gitbash I still decided to continue using Powershell.

drawing

SSH Key/Clone Git

The best way to use Git is working locally but to be able doing this we need to set up the SSH key. The easiest thing to do was to follow a Gitlab tutorial

To generate a SSH key, we just need to type in the terminal the following command

ssh-keygen -t ed25519 -C "danilo.fumagalli@polimi.it"

I’ll use the SSH key to have direct access to my repository so I can easily obtain and submit modifications to my page.

To do this we need to past the SSh key in the “SSH keys” section of “Preferences” menu inside our personal page on Gitlab

Then we can proceed to clone our repository using the following command line

git@gitlab.fabcloud.org:academany/fabacademy/2022/labs/opendot/students/danilo-fumagalli.git

Git commands

Below are the basic commands to use Git and the use made of it

git pull

pulls all modifications from the cloud, will update the local repository with these changes.

git add 

adds new or changed files in your working directory to the Git staging area

git status

shows the current state of your Git working directory and staging area

git commit 

is used to save your changes to the local repository.

git push

uploads all local branch commits to the corresponding remote branch.

Mkdocs

To build the site, having never had previous experience, I decided to rely on the recommended static site generator Mkdocs and browse a bit between resources and tutorials in order to get an idea of ​​what building a site means

Using the command

pip install mkdocs

I installed the latest version of Mkdocs.

MkDocs requires a recent version of Python and the Python package manager, pip, to be installed on your system, so using the following commands I checked for the version installed in my laptop (I had already updated them before installing Mkdocs)

pip install mkdocs

Now I’ve got both last version

DANILO@LAPTOP-DTMJ9QF6 ~
$ python --version
Python 3.10.2

DANILO@LAPTOP-DTMJ9QF6 ~
$ pip --version
pip 22.0.2 from C:\Users\DANILO\AppData\Local\Programs\Python\Python310\lib\site-pac
kages\pip (python 3.10)

Coding with Visual Studio Code

Antonio suggested several code editor programs (Sublime, Atom, Visual Code, …). I ultimately settled on Visual Studio Code for several reasons:

1.support for hundreds of languages (maybe in the future…) 2.it’s very simple 3.open-source 4.I can use the terminal in virtual studio code to commit and push my changes in the repository

The syntax language used in mkdocs is Markdown, a plain-text editor. Easy-to-read and easy-to-write. And then it can be published in HTML format.

The flip side of Markdown is represented by the limitations of the language itself (sometimes you can switch to other languages, like HTML or Javascript…but I’didn’t try…yet)