-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript_git_windows.ps1
More file actions
51 lines (39 loc) · 1.52 KB
/
Copy pathscript_git_windows.ps1
File metadata and controls
51 lines (39 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Installer GitHub CLI via winget
Write-Host "Installation de GitHub CLI..."
winget install --id GitHub.cli
# Authentification avec GitHub CLI
Write-Host "Authentification avec GitHub CLI..."
gh auth login
# Créer un dossier pour le nouveau repo
$nom_dossier = Read-Host "Entrez le nom du dossier à créer"
New-Item -Path . -Name $nom_dossier -ItemType "directory"
Set-Location $nom_dossier
# Créer un repo GitHub
Write-Host "Création d'un nouveau repo GitHub..."
gh repo create
# Modifier le README
$texte_readme = Read-Host "Entrez le texte à ajouter au README"
Add-Content -Path "README.md" -Value $texte_readme
# Ajouter les modifications au Staging Area
git add README.md
# Commit avec un message
$message_commit = Read-Host "Entrez un message pour le commit"
git commit -m $message_commit
# Pousser les modifications vers le repo distant
$lien_repo = Read-Host "Entrez l'URL du repo distant"
git push $lien_repo
# Cloner le repo d'un collègue
$dossier_clone = Read-Host "Entrez le nom du dossier pour cloner un repo"
New-Item -Path . -Name $dossier_clone -ItemType "directory"
Set-Location $dossier_clone
$lien_clone = Read-Host "Entrez l'URL du repo à cloner"
git clone $lien_clone
# Modifier le README du repo cloné
Set-Location (Split-Path $lien_clone -Leaf)
$texte_readme = Read-Host "Entrez le texte à ajouter au README"
Set-Content -Path "README.md" -Value $texte_readme
# Ajouter les modifications au Staging Area et committer
git add README.md
git commit -m $message_commit
# Pousser vers le repo distant
git push $lien_clone