Table des matières
4 billet(s) pour janvier 2026
| AWX sur K8S Kind - partage de fichier pour les blob - Execution pods | 2026/01/26 10:15 | Jean-Baptiste |
| Notes rsh rcp | 2026/01/21 18:08 | Jean-Baptiste |
| Git - Duplication d'un dépôt | 2026/01/19 10:22 | Jean-Baptiste |
| Exemple simple de conf Nagios | 2026/01/14 10:07 | Jean-Baptiste |
Notes Git Annex
Blog
Chiffrement
Autre
Synchro automatique avec git annex assistant
Le fichier ~/.config/git-annex/autostart contient la liste des dépôts a synchroniser
~/.config/git-annex/autostart
/home/jean/annex2 /home/jean/annex
git annex dead usbdrive git annex semitrust usbdrive git annex add $file git annex merge git annex sync git annex sync --content git annex copy $file --to otherrepo git annex numcopies 2 git annex drop . --from cloud git annex forget --drop-dead
Centralisé
https://git-annex.branchable.com/tips/centralized_git_repository_tutorial/
On the server I did:
git init --bare git annex init origin
On Cĺient Alice (I want to give Bob a chance get call “git annex get” from “origin”):
git clone ssh://tktest@192.168.56.104/~/annex . git annex init Alice git annex merge git annex add . git commit -a -m "Added tutorial" git push origin master git-annex git annex copy . --to origin
git annex initremote myrsync type=rsync rsyncurl=ssh.example.com:/myrsync keyid=id@joeyh.name encryption=pubkey keyid=KEYID git annex describe myrsync “rsync server” git annex enableremote myrsync
git annex enableremote myrsync keyid+=788A3F4C
git annex testremote myrsync
Désactiver temporairement git config remote.myrsync.annex-ignore false
git annex unused --from myrsync git annex dropunused --from myrsync 1
Décontralisé
Sur toutes les machines mkdir ~/annex cd ~/annex git init git annex init “$HOSTNAME $PWD” git annex add .
cd ~/annex git remote add machine1 user@machine1:annex
git annex get .
Exemple
git annex add fic git annex get fic git rm fic git annex drop fic git mv fic1 fic1.old
git annex sync
git annex unlock my_cool_big_file
git annex unused git annex fsck
Delete all the copies method
Source http://git-annex.branchable.com/tips/deleting_unwanted_files/
git annex drop --force file git annex whereis file git annex drop --force file --from $repo rm file; git annex sync
Si Pb de performance
git repack -ad git gc
Si le git status est long
git config core.ignoreStat true
Métadonnées remote.log uuid.log
Voir
git show git-annex:remote.log git cat-file -p git-annex:remote.log
Editer / Modifier l'object blob de git (remote.log ou uuid.log)
export EDITOR=vim git replace --edit git-annex:remote.log
Pour voir les métadonnées associé à un fichier
git annex metadata fichier
Mode direct
Passer en mode Direct
En mode Direct les fichiers sont directement modifiables
git annex direct
Puis, si l'historique des versions est importante alors il convient de marquer ce dépôt à “untrust”. Comme la modification en écriture est activée et que un git annex sync fera un “commit”
git annex untrust .
A tout moment nous pouvons repasser en mode Indirect (pour utiliser les commandes Git, par exemple)
git annex indirect
Pour modifier un fichier en mode Indirect
git annex unlock fichier
En mode Direct, les commandes git peuvent être utilisées grâce à la commande préfixe git annex proxy
git annex undo file
Gestion de la confiance
semitrust (défaut), untrust, trust, dead
git annex untrusted [Dépôt]
Exemple :
git annex untrusted .
--trust pas être utilisé comme option
Configuration
http://git-annex.branchable.com/backends/
.gitattributes
*.mp4 annex.backend=MD5E *.webm annex.backend=MD5E *.flv annex.backend=MD5E *.3gp annex.backend=MD5E *.mov annex.backend=MD5E *.mkv annex.backend=MD5E *.divx annex.backend=MD5E *.avi annex.backend=MD5E *.zip annex.backend=MD5E *.iso annex.backend=MD5E *.webm annex.numcopies=1
Note : à faire avant le git annex init ou voir git annex migrate si changement du backend (Fonction de hachage, içi MD5E)
Modifier la conf
git annex vicfg
Pb
$ git annex fsck --from=myspecialremote gpg: can't query passphrase in batch mode gpg: decryption failed: secret key not available
Solution
eval $(gpg-agent --daemon)
Si pas d’interface graphique
export GPG_TTY=$(tty)
Information pour debug
git-annex list git-annex whereis FICHIER git-annex info REMOTE git annex get . --from REMOTE --debug git annex fsck --from REMOTE
git annex unused
git annex test
Si un “special remote” a été décommissionné
git annex drop . --from cloud --force git remote remove cloud
Notes git - Remove the secret
Remove the secret Remove a blocked secret to allow the commit to be pushed to GitLab. The method of removing the secret depends on how recently it was committed. The instructions below use the Git CLI client, but you can achieve the same result by using another Git client.
If the blocked secret was added with the most recent commit on your branch
- Remove the secrets from the files.
- Stage the changes with
git add < file-name >. - Modify the most recent commit to include the changed files with
git commit --amend. - Push your changes with
git push.
If the blocked secret appears earlier in your Git history
- Optional. Watch a short demo of removing secrets from your commits.
- Identify the commit SHA from the push error message. If there are multiple, find the earliest using
git log. - Create a copy branch to work from with
git switch --create copy-branchso you can reset to the original branch if the rebase encounters issues. - Use
git rebase -i <commit-sha>~1to start an interactive rebase. - Mark the offending commits for editing by changing the pick command to edit in the editor.
- Remove the secrets from the files.
- Stage the changes with
git add < file-name >. - Commit the changed files with
git commit --amend. - Continue the rebase with git rebase --continue until all secrets are removed.
- Push your changes from the copy branch to your original remote branch with
git push --force --set-upstream origin copy-branch:<original-branch>. - When you are satisfied with the changes, consider the following optional cleanup steps.
- Optional. Delete the original branch with
git branch --delete --force <original-branch>. - Optional. Replace the original branch by renaming the copy branch with
git branch --move copy-branch <original-branch>.
Notes git - Convention commit - Bien nommer ses commits
Voir :
Voir :
Type
Must be one of the following:
- feat: A new feature
- fix: A bug fix
- docs: Documentation only changes
- style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- refactor: A code change that neither fixes a bug nor adds a feature
- perf: A code change that improves performance
- test: Adding missing or correcting existing tests
- chore: Changes to the build process or auxiliary tools and libraries such as documentation generation
Voir : 11 tips for writing a good Git commit message
https://github.com/cisagov/development-guide
Voir aussi :
Pull request example
Type of change
- Patch fixing an issue (non-breaking change)
- New functionality (non-breaking change)
- Functionality enhancement or optimization (non-breaking change)
- Breaking change (patch or feature) that might cause side effects breaking part of the Software
Checklist
- I have followed the coding style guidelines provided by Centreon
- I have commented my code, especially hard-to-understand areas of the PR.
- I have rebased my development branch on the base branch (develop).
- I have provide data or shown output displaying the result of this code in the plugin area concerned.
Type of change
- Patch fixing an issue (non-breaking change)
- New functionality (non-breaking change)
- Functionality enhancement or optimization (non-breaking change)
- Breaking change (patch or feature) that might cause side effects breaking part of the Software
Checklist
- I have followed the coding style guidelines provided by Centreon
- I have commented my code, especially hard-to-understand areas of the PR.
- I have rebased my development branch on the base branch (develop).
- In case of a new plugin, I have created the new packaging directory accordingly.
- I have implemented automated tests related to my commits.
- Data used for automated tests are anonymized.
- I have reviewed all the help messages in all the .pm files I have modified.
- All sentences begin with a capital letter.
- All sentences end with a period.
- I am able to understand all the help messages, if not, exchange with the PO or TW to rewrite them.
- After having created the PR, I will make sure that all the tests provided in this PR have run and passed.
It shouldn't exist (but it does)
Est-ce qu'il y a une convention Git de message de commit pour dire “c'est trop de la m…. je ne cautionne pas, et j'ai trop honte de voir mon nom gravé dans l'historique des commits” ? Il y a bien GLWTPL, mais ça c'est pour la licence.
J'ai vu des horreurs dans le code, déjà que j'aime pas les films d'horreurs mais là je suis choqué. et pas le temps de refactorer
Proposition :
- It shouldn't exist but it does.
- Abomination
- Aberration
- It saddens me to see this
- It should be forbidden / SHOULD BE BANNED
Autres
Règle d'organisation du dépôt
Règle d'organisation du dépôt
Les dépôts sont organisés selon une arborescence qui respecte les règles suivantes :
- le nom des répertoires est le plus explicite possible et ne contient pas d'accents et d'espaces (remplacer par un souligné),
- l'encodage des fichiers textes et des tables (type .csv) est en UTF-8,
- dans la mesure du possible, chaque nœud de l'arborescence contient un fichier Readme.md (en markdown) qui présente brièvement les répertoires
Source : https://sourcesup.renater.fr/www/si-snot/5_MO_VersionnementGit.html
Exemple de un unique dépôt pour plusieurs exécutables :
Notes ghost image système CloneZilla
Voir :
Mot de passe pour la console
| User | user |
| Password | live |
Autres
sudo su loadkeys fr lsblk grep linux /run/live/medium/boot/grub/grub.cfg cat /etc/ocs/ocs-live.conf ocs-live-restore
Error : Disk “” not found on the system!
Automatic cloning without confirmation
-batch
# ocs_live_extra_param="-batch -g auto -e1 auto -e2 -r -j2 -p true restoredisk my-image sda" ocs_live_extra_param="-g auto -e1 auto -e2 -r -j2 -p true restoredisk my-image sda"
Autres
ocs_live_run="ocs-live-general" ocs_live_run="ocs-live-restore"
Clavier
ocs_live_keymap="/usr/share/keymaps/i386/qwertz/fr_CH-utf8.kmap.gz" ocs_lang="en_US.UTF-8"
Autres
CloneZilla utilise sfdisk
LC_ALL=C grep -Ev '^last-lba:' sdb-pt.sf |sfdisk --wipe always --force /dev/sdb
sdb-pt.sf
label: gpt label-id: 2668D20F-7249-4150-978E-ECD8595A596A device: /dev/sdb unit: sectors first-lba: 34 last-lba: 1873280990 sector-size: 512
Changer le nom ou l'IP d'un serveur GNU/Linux
Template VM
Voir :
RedHat registration
subscription-manager unregister
subscription-manager remove --all
subscription-manager clean
Hostname
hostnamectl set-hostname localhost.localdomain
Udev
rm -rf /etc/udev/rules.d/70-*
machine-id
chmod 777 /etc/machine-id > /etc/machine-id chmod 444 /etc/machine-id
Voir aussi :
- /sys/class/dmi/id/product_uuid
- /sys/class/dmi/id/product_name
Qui peuvent être copiés sur l'image cible pour savoir sur quel matériel l'image a été créée.
Réseau
rm -f /etc/sysconfig/network-scripts/ifcfg-eth* #sed -i '/UUID/c\UUID=' /etc/sysconfig/network-scripts/ifcfg-eth0 #sed -i '/HWADDR/c\HWADDR=' /etc/sysconfig/network-scripts/ifcfg-eth0
Clean /var/log/
find /var/log/ -type f -name "*[-_]2018[0-9][1-9][0-9][1-9]*" -delete find /var/log/ -type f -name "*.old" -delete rm -rf /var/log/journal/* systemd-tmpfiles --create --prefix /var/log/journal systemctl restart systemd-journald #for fic in $(find /var/log/ -type f) ; do > $fic ; done find /var/log/ -type f -exec /bin/sh -c '>{}' \; rm /var/log/sysstat/* -rf find /var/log/ -type f -name "*.*[0-9]" -delete find /var/log/ -type f -name "*.gz" -delete
# Debian killall dhclient #rm /var/lib/dhcp/dhclient.eth0.leases rm -f /var/lib/dhcp/* killall ntpd rm /run/ntp.conf.dhcp
Autres RedHat
# systemctl enable initial-setup.service # sys-unconfig # touch /.unconfigured
Bash history
rm -f /root/.bash_history rm -f /home/*/.bash_history history -c && history -w
Poweroff
poweroff
Renommer un serveur
grep $(hostname -s) -Ril /etc/
Fichier à modifier
- /etc/machine-id
- /etc/hosts
- /etc/hostname
- /etc/mailname
- /etc/exim4/update-exim4.conf.conf
- /etc/machine-info
- /etc/sysconfig/network
rm -f /etc/machine-id systemd-machine-id-setup
SSH
dpkg-reconfigure openssh-server
Ou
# CHANGER LE HOSTNAME AVANT ! #rm /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub #rm /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub #rm /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub #ssh-keygen -h -N '' -t rsa -f /etc/ssh/ssh_host_rsa_key #ssh-keygen -h -N '' -t dsa -f /etc/ssh/ssh_host_dsa_key #ssh-keygen -h -N '' -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key rm -f /etc/ssh/ssh_host_* /usr/bin/ssh-keygen -A
hostnamectl set-hostname nouveau-nom systemctl restart systemd-hostnamed
Changement d'adresse IP
Fichier à modifier
- /etc/resolv.conf
- /etc/systemd/resolved.conf
- /etc/network/interfaces
Conf client DNS
- /etc/resolv.conf
#domain acme.local search acme.local options rotate timeout:1 retries:1 #options edns0 nameserver 192.168.10.253 nameserver 192.168.11.253
Avec SystemD voir /etc/systemd/resolved.conf
Généralités
Parfois il faut aussi modifier les fichiers suivants
- /etc/motd
- /etc/issue
