- Theory and tutorials
- Documentation content
Theory and tutorials
GIT:
Introduction:
-
Slides:
GIT Intro Slides -
Tutorial and reference book (more tutorials below): https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository.
-
REMEMBER there are 3 different storages areas - Workspace: Folder that you are editing - Local repo: Storage for different version of your projects inside your computer - Remote repo: Storage for different version of your projects in a remote server (you can shareit with others)
Basic commands:
- Cheat sheet: Github cheatsheet
- Workflow:
- Provide initial configuration
git config --global user.name "John Doe"
git config --global user.email "ivan.sanchez@oulu.fi"
- Download the repo from the remote repository to your computer (creating a local repository). You just need to do this once:
git clone url
- Move updates (generally made by others) from remote repo to your local repo:
git pull origin master
- Store changes that you have done in your local repo:
git add .
git commit -m “message”` - Move updates from local repo to remote repo:
git push origin master
GITIGNORE
Sometimes you have files that you do not want to include in the repo: eg. .DS_STORE in Mac, or executables (.exe, .class …). In that case, you can add a .gitignore file (a text file with name .gitignore) to the root of your repo.
Tutorials:
I recommend use gitignore, specially for people who is using MAC. Gitlab has some templates for .gitignore (add file/gitignore)
Interactive tutorials
Other tutorials
- http://rogerdudler.github.io/git-guide/
- https://www.atlassian.com/git/tutorials
- https://gitlab.com/Rloota/521002p-agile-tools/-/wikis/Working-with-Git
SSH keys in gitlab:
- Gitlab Is a cloud application in which you can create git repositories (among other multiple things): https://gitlab.fabcloud.org
- You need to generate a pair of public/private key to identify yourself with the gitlab server:
- PUBLIC KEY: You can share with anyone. You need to store it in gitlab -> https://gitlab.fabcloud.org/-/profile/keys
- PRIVATE KEY: You DO NOT share with anyone. It stays in your computer.
Some links:
- https://docs.gitlab.com/ee/ssh
- (ADVANCED) https://docs.gitlab.com/ee/user/ssh.html#configure-ssh-to-point-to-a-different-directory
- (ADVANCED) https://stackoverflow.com/questions/3225862/multiple-github-accounts-ssh-config
Workflow:
- In Windows open the GIT BASH CMD. In Linux/Mac: open the terminal
- Type the command
ssh-keygen -t rsa -C "your.email@example.com" -b 4096
- The pair of public/private key is stored in: your_home_directory/.ssh
- id_rsa -> Private key
- id_rsa.pub -> Public key
- Open the Public key (id_rsa.pub) with a text editor and copy its content in https://gitlab.fabcloud.org/-/profile/keys
Debugging:
If you have problems you can debug how your system access your key values using:
ssh -vvT git@gitlab.fabcloud.org
NOTE REGARDING BIG FILES
YOU MUST NOT BIG FILES TO THE REPO: Files bigger than few MB are problematic. You need to compress images so it occupies ~100-200 KB MAXIMUM (average would be ~20 – 50 KB) and resolutions: 800x600; 1024x768; If you need some more detail you can make it bigger (example a screenshot with small letter).
You can list the size of the files BEFORE SENDING TO THE REPO using the following command in the terminal (Use GIT BASH CMD in Windows)
du -s * | sort -rn
COMMON MISTAKES (NEIL’s PRESENTATION):
- key path, permissions
chmod go-rwx ~/.ssh/key_name
-
archive size
~MB/person/week
-
check before commit
du -s * | sort -rn
- compress, resize pictures for Web
convert
- link to external videos
- pull and merge before pushing, never force
- refresh browser after editing page
HANDLING IMAGES
-
You can take screenshots either using the Snipping tool from Window or Sharex (Not tested myself)
-
Fatstone image resizer (GUI): http://www.faststone.org/FSResizerDetail.htm
-
Power Toys offers some tools to resize
-
Image magick (Command line): https://www.imagemagick.org/script/index.php
-
Resize a set of jpg images to 800x600 reducing considerably its quality
convert *.jpg -resize 800x600 -strip -quality 40 destination.jpg
-
The same for png files:
convert *.png -resize 800x600 -strip -depth 8 -define png:compression-level=9 destination.png convert origin.png -resize 800x600 -depth 8 -strip -define png:compression-filter=2 -define png:compression-level=9 -define png:compression-strategy=1 destination.png
-
-
Merge to images having a maximum width of 800px:`
montage -geometry 400x300+10-30 screen1.png screen2.png out.png
-
More commands:
-
convert arguments: https://www.imagemagick.org/script/convert.php
-
montage arguments: https://www.imagemagick.org/script/montage.php
-
-
Convert (command line): http://www.graphicsmagick.org/convert.html
Markdown
Markdown is a lightweight markup language with plain text formatting syntax. Its design allows it to be converted to many output formats, but the original tool by the same name only supports HTML.Markdown is often used to format readme files, for writing messages in online discussion forums, and to create rich text using a plain text editor (from Wikipedia)
Static web generator
Best static site generators to start with:
-
Mkdocs. You have few themes in this link.
- In FabAcademy we have been using Material theme for the last few years. You can find in this gitlab repository all necesary files to run it in your Gitlab.
-
Hugo. You can find free Hugo themes here.
- I created an example project running on Gitlab.
Removing files
- If you want to remove all the files that are in your repo:
git rm -r .
git commit -m "Removed all files"
git push origin master
Documentation content
Project page
- Give a short description of the project
- What is the system functionality?
- Why do you want to build this project?
- Include a picture showing your system (just a sketch drawn on a paper would be enough)
About me page
- Description of who you are
- Background
- Past project (if any)
- Why are you doing Fab Academy
Week 1 assignment
-
Link to the tutorial that you have follow in order to learn GIT
- Explain the problems you face while following the tutorial and how you solved them.
- What did you learn out of this tutorial.
-
Explain in detail how you created the public/private key and how did you uploaded it to gitlab
- Include screenshots
-
Explain the GIT workflow:
clone - pull -- add -- commit -- push
- Explain what each command do.
-
Explain in detail how did you upload your first version of the website to gitlab
- Include screenshots
- Do not forget to tell if you modified any configuration file (
yml
)- Why is this configuration file necessary?
- Do not forget to mention where did you get your clone URL
-
Explain how did you create the website
- If you used a web static generator application, give some short information about it.
- Tell which template/theme did you use
- Show which configuration files you modified
- If you modified the layout show in a picture what would you like to be your final layout
- Explain briefly which files did you modified to change the layout / functionality of the site
- E.g. css, javascript, md
- Tell which editor did you used to modify the files
- If you used web static generator tell which extensions and plugins did you use.
- Tell how you modified configuration files.
- INCLUDE SCREENSHOTS OF THE PROCESS
-
Do not forget to mention where you found problems and how you solved them
- PROCESS DOCUMENTATION NOT TUTORIAL LIKE DOCUMENTATION
Miscellanea
- Do not forget to upload the agreement signed
- Acknowledge pictures/other material you took from internet. Be sure you have the right permissions to use them.
- Remember to have adequate resolution for the web. Each image should occupy ~10-50 KB
Additional resources:
- Kris (Fab Lab Aalto) has compiled an amazing set of videos explaining in detail everything you need to know to create websites in gitlab: https://www.youtube.com/playlist?list=PLruSKIDLbfPw_FpKiUghLMHLKA9-zSo8j