====== Git ======
===== Démarrage Git Exalead =====
Depuis le répertoire Projects :
git init kautex-ciu
cd kautex-ciu
git remote add origin https://gitlab.paris.exalead.com/consulting/customers/kautex.git
git config http.sslVerify false
git pull origin main
Ajout du projet généré depuis app-extend
git add .
git commit -m "Kautex CIU first commit"
git push origin main
Attention : dans GitBash on peut être dans master.
Pour régler cela, il faut renommer la branche Local master à main
git branch -m master main
===== Commandes utiles =====
$ git remote -v
origin n3i@gitlab.paris.exalead.com:consulting/customers/edf/edf-hpc.git (fetch)
origin n3i@gitlab.paris.exalead.com:consulting/customers/edf/edf-hpc.git (push)
==== Commandes de branches ====
* MAJ des données git sans merge (utilie pour avoir la liste des branches)
git fetch
* Liste des branches
git branch -r
* Basculer entre les branches
git checkout
[[https://git-scm.com/book/fr/v2/Les-branches-avec-Git-Les-branches-en-bref|Pour plus d'infos]]
===== Clone/Push avec erreur de ‘self signed certificate’ =====
La commande de clone peut être la suivante :
git clone https://gitlab.paris.exalead.com/consulting/customers/bmw_plm.git
Mais, on peut avoir le message suivant :
fatal: unable to access 'https://gitlab.paris.exalead.com/consulting/customers/bmw_plm.git/': SSL
certificate problem: self signed certificate in certificate chain
Pour y remédier, il faut utiliser le paramètre //-c http.sslVerify=false//
* Commande par commande :
git -c http.sslVerify=false clone https://gitlab.paris.exalead.com/consulting/customers/bmw_plm.git
* Paramètre général :
git config http.sslVerify false
===== Modification du mot de passe Git sous Windows =====
- Ouvrir 'Control Panel\User Accounts\Credential Manager'
- Choisir 'Windows Credentials'
- Dans la section 'Generic Credentials', modifier les mots de passe des utilisateurs 'git'
[[https://cmatskas.com/how-to-update-your-git-credentials-on-windows/|Pour plus d'infos]]
===== Création d'une clé SSH avec 'Git Bash' et utilisation dans GitLab =====
- Dans 'Git Bash', exécuter la commande 'ssh-keygen' en la stockant dans '~/.ssh/id_rsa'
- Entrer la passephrase
- Login to GitLab account and goto 'Account\Settings\SSH Keys'
- Dans la section "Key", entrer le contenu du fichier "id_rsa.pub" et cliquer sur "Add key"
Si on change la clé pour un git, il faut supprimer la ligne dans le fichier ~/.ssh/known_hosts
ssh-keygen -R gitlab.paris.exalead.com
Après, en refaisant un git pull, on a les lignes suivantes :
$ git pull
The authenticity of host 'gitlab.paris.exalead.com (100.64.1.40)' can't be established.
ED25519 key fingerprint is SHA256:hfZnSwD+cdlWcONebVYFtKOCfaH87kjpdfIPKClzO4s.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'gitlab.paris.exalead.com' (ED25519) to the list of known hosts.
Already up to date.
===== Utilisation de SSH-Agent pour rentrer le mot de passe une seule fois =====
Dans ~/.profile, mettre
env=~/.ssh/agent.env
agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; }
agent_start () {
(umask 077; ssh-agent >| "$env")
. "$env" >| /dev/null ; }
agent_load_env
# agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2= agent not running
agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?)
if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then
agent_start
ssh-add
elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then
ssh-add
fi
unset env
Au premier démarrage de la journée, le système demande ma paraphrase.
Pour tester
ssh -T git@gitlab.paris.exalead.com
[[https://help.github.com/en/github/authenticating-to-github/working-with-ssh-key-passphrases|Working with SSH key passphrases]]
===== Pour Stellantis =====
==== Génération du package OnePart Central ====
Dans GitBash, depuis le répertoire /E/Exalead/Projects/stla/onepart-central, lancer la commande :
mvn clean package -P skip_reports
==== Changement de branche ====
Pour changer de branche
$ git branch -r
> origin/R1.0_bugfixes
> origin/R1.1_bugfixes
> origin/R_1.3_Bugfixes
> origin/main
$ git checkout R_1.3_Bugfixes
> branch 'R_1.3_Bugfixes' set up to track 'origin/R_1.3_Bugfixes'.
> Switched to a new branch 'R_1.3_Bugfixes'
$ git status
> On branch R_1.3_Bugfixes
Pour pousser dans la branche
$ git push origin R_1.3_Bugfixes