Ceci est une ancienne révision du document !
Table des matières
Git/Gitlab courses UFU 2026
Prerequisites
Install Windows Subsystem for Linux (WSL)
Open a PowerShell in administrator mosde by clicking with the right button and select “execute as administrator”
We can list the available distributions :
PS C:\WINDOWS\system32> wsl.exe --list --online Voici la liste des distributions valides qui peuvent être installées. Installez à l’aide de 'wsl.exe --install <Distro>'. NAME FRIENDLY NAME Ubuntu Ubuntu Ubuntu-26.04 Ubuntu 26.04 LTS Ubuntu-24.04 Ubuntu 24.04 LTS Ubuntu-22.04 Ubuntu 22.04 LTS openSUSE-Tumbleweed openSUSE Tumbleweed openSUSE-Leap-16.0 openSUSE Leap 16.0 SUSE-Linux-Enterprise-15-SP7 SUSE Linux Enterprise 15 SP7 SUSE-Linux-Enterprise-16.0 SUSE Linux Enterprise 16.0 kali-linux Kali Linux Rolling Debian Debian GNU/Linux AlmaLinux-8 AlmaLinux OS 8 AlmaLinux-9 AlmaLinux OS 9 AlmaLinux-Kitten-10 AlmaLinux OS Kitten 10 AlmaLinux-10 AlmaLinux OS 10 archlinux Arch Linux FedoraLinux-44 Fedora Linux 44 FedoraLinux-43 Fedora Linux 43 eLxr eLxr 12.12.0.0 GNU/Linux OracleLinux_7_9 Oracle Linux 7.9 OracleLinux_8_10 Oracle Linux 8.10 OracleLinux_9_5 Oracle Linux 9.5 SUSE-Linux-Enterprise-15-SP6 SUSE Linux Enterprise 15 SP6
To install a specific distribution, we use the following command:
wsl.exe --install -d [Distro]
For example to install Archlinux :
wsl.exe --install -d archlinux
Without '-d' option, the Ubuntu distribution in its last release will be installed.
PS C:\WINDOWS\system32> wsl --install
Téléchargement en cours : Sous-système Windows pour Linux 2.7.11
Installation en cours : Sous-système Windows pour Linux 2.7.11
Sous-système Windows pour Linux 2.7.11 a été installé.
Installation du composant facultatif Windows : VirtualMachinePlatform
Outil Gestion et maintenance des images de déploiement
Version : 10.0.26100.8521
Version de l’image : 10.0.26200.8655
Activation de la ou des fonctionnalités
[==========================100.0%==========================]
L’opération a réussi.
L’opération demandée est réussie. Les modifications ne seront pas effectives avant que le système ne soit réamorcé.
Téléchargement : Ubuntu
Installation : Ubuntu
La distribution a été installée. Il peut être lancé via 'wsl.exe -d Ubuntu'
Lancement : Ubuntu...
Provisioning the new WSL instance Ubuntu
This might take a while...
Create a default Unix user account: yann
Create a default Unix user account: yann
New password:
Retype new password:
passwd: password updated successfully
usermod: no changes
Help improve Ubuntu!
Help us improve Ubuntu features and compatibility by sharing system reports with Canonical.
Reports are sent anonymously and do not contain any personal data.
For legal details, please visit: https://ubuntu.com/legal/systems-information-notice
We will save your answer to Windows and will only ask you once.
Would you like to opt-in to platform metrics collection (Y/n)? To see an example of the data collected, enter 'e'.
e
{
"insightsVersion": "0.9.3ubuntu",
"collectionTime": 1786024928,
"systemInfo": {
"hardware": {
"cpu": {
"name": "13th Gen Intel(R) Core(TM) i7-13850HX",
"vendor": "GenuineIntel",
"architecture": "x86_64",
"cpus": 28,
"sockets": 1,
"coresPerSocket": 14,
"threadsPerCore": 2
},
"memory": {
"size": 15816
},
"disks": [
{
"size": 356,
"type": "disk"
},
{
"size": 159,
"type": "disk"
},
{
"size": 4096,
"type": "disk"
},
{
"size": 1048576,
"type": "disk"
}
]
},
"software": {
"os": {
"family": "linux",
"distribution": "Ubuntu",
"version": "26.04"
},
"timezone": "CEST",
"language": "C"
},
"platform": {
"wsl": {
"subsystemVersion": 2,
"systemd": "used",
"interop": "enabled",
"version": "2.7.11.0",
"kernelVersion": "6.18.33.2-microsoft-standard-WSL2"
}
}
}
}
Would you like to opt-in to platform metrics collection (Y/n)? To see an example of the data collected, enter 'e'.
[Y/n/e]: y
yann@lcom-is-m-maif2:/mnt/c/WINDOWS/system32$
Run WSL and install linux updates
Search for wsl in the search barre :
and click on “Open/Run” you should get the following window:
Now we update the system:
yann@lcom-is-m-maif2:~$ sudo apt update yann@lcom-is-m-maif2:~$ sudo apt upgrade
Install gcc, git and more
yann@lcom-is-m-maif2:~$ sudo apt install build-essential dos2unix tree gitk gedit yann@lcom-is-m-maif2:~$ sudo apt install git git-lfs
Find your linux files from windows
Copy/Paste/Move files from a system to another : Zone.Identifier files
Zone.Identifier files in WSL are sidecar metadata files created when you copy or move a file downloaded from the internet on Windows into your Windows Subsystem for Linux (WSL) filesystem.
Windows natively tracks downloaded files using a security feature called Mark of the Web (MOTW). Because Linux filesystems do not support this specific Windows feature, WSL extracts that hidden data and saves it as a separate visible file.
Zone.Identifier files are a security metadata mechanism introduced by Windows to mark files downloaded from untrusted locations, like the internet. On Windows NTFS drives, this data is hidden inside an Alternate Data Stream (ADS). However, when you move or copy these files into a Linux filesystem via the Windows Subsystem for Linux (WSL), Linux treats this stream as a separate, visible file. These files often clutter directories and can break Linux scripts due to the colons in their filenames.You can safely delete existing identifier files, prevent Windows from creating them, or force your Git repository to ignore them.
Delete Existing Files Recursively
To clean up clutter in your current WSL directory, you can safely scan and remove them using the Linux find command:
find . -name "*:Zone.Identifier" -type f -delete
alias purge-zone='find . -name "*:Zone.Identifier" -type f -delete'
to your ~/.bashrc file.
Disable Creation via Windows Group Policy
You can stop Windows from generating this data globally so that future file transfers do not create new identifier files:
- Press Win + R, type
gpedit.msc, and pressEnter. - Navigate to:
User Configuration > Administrative Templates > Windows Components > Attachment Manager. - Open Do not preserve zone information in file attachments.
- Set the policy to
Enabled, click Apply, and select OK.
Disable Creation via Windows Registry
If you are using Windows Home edition and lack the Group Policy Editor, you can use the Registry Editor to achieve the same result:
- Press Win + R, type
regedit, and pressEnter. - Navigate to:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\AttachmentsNote: If the Attachments key does not exist, right-click Policies, selectNew > Key, and name itAttachments. - Right-click inside the Attachments folder, select
New > DWORD (32-bit) Value, and name itSaveZoneInformation. - Double-click
SaveZoneInformationand change its value data to 1.
Hide Files from Git Repositories
If these files frequently pop up in your project work and you want to prevent them from being committed to Git, add them to your tracking block:
- Add the following line to your project's
.gitignorefile:text*:Zone.Identifier
Interoperability
This error occurs because your shell script has Windows line endings (CRLF) instead of Linux line endings (LF). Linux reads the hidden carriage return character (\r, shown as ^M) as part of the path, making it look for an interpreter named /bin/bash\r, which does not exist.
Here are the quickest ways to fix your script:
Method 1: Convert using sed (No installation required)
Run this command directly in your WSL terminal to strip out the Windows carriage returns:
sed -i 's/\r$//' your_script.sh
Method 2: Use dos2unix (Cleanest method)
If you have dos2unix installed (or want to install it via sudo apt install dos2unix), it fixes the file instantly:
dos2unix your_script.sh
Method 3: Fix it in VS Code
If you are editing the file in Windows using VS Code:
- Look at the bottom right corner of the VS Code window.
- Click on CRLF.
- Select LF from the drop-down menu.
- Save the file.
Using git, how to prevent this in the future
If you use Git, you can configure it to automatically handle line endings properly across Windows and WSL by running:
git config --global core.autocrlf false
Writing conventional commit message
source : https://www.conventionalcommits.org/en/v1.0.0/
A conventional commit message follows the strict structure <type>[optional scope]: <description>, aligning with the Conventional Commits specification.
It uses standard types like feat (feature) and fix (bug fix) to create a clean, automated, and machine-readable project history.
Core Structure
- Header:
<type>(<scope>): <description>(Required) - Body: Detailed explanation of the what and why (Optional)
- Footer: Issue tracking references or breaking changes (Optional)
Common Commit Types
- feat: A new feature for the user or API
- fix: A bug fix for the codebase
- docs: Changes to documentation (like README)
- style: Formatting changes that do not affect code logic (white space, semicolons)
- refactor: Code restructuring that neither fixes a bug nor adds a feature
- perf: Performance improvementstest: Adding or updating tests
- chore: Maintenance tasks or build/tooling changes
Quick Rules to Follow
- Write the description in the imperative present tense (e.g., “add”, not “added” or “adds”).
- Keep the first line under 50 characters and do not add a period at the end.
- Append ! after the type/scope (e.g., feat(api)!:) to signal a breaking change.
Using Git with windows
To use git directly with windows, you need to install it from https://git-scm.com/install/windows
Inside windows explorer you can access git using a gui or a shell bash as viewed in this courses :










