Created
February 2, 2016 13:47
-
-
Save dtarcz/06f89790d88880336772 to your computer and use it in GitHub Desktop.
automate git create repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# Un script bash pour automatiser la creation de repository git | |
echo "On va demarrer git" | |
# Le nom du repo sera l'argument de la commande : | |
mkdir $1 | |
# On va se placer dans le repo : | |
cd $1 | |
# On initialise un repo vide : | |
git init | |
# Creation du README.md | |
# Ecriture de quelques lignes dans le README : | |
echo "# Projet $1" > README.md | |
echo "## par [David TARCZEWSKI](http://tarczewski.fr)" >> README.md | |
# On crée un fichier d'index.html vide | |
touch index.html | |
# Et on le remplira d'un squelette de page html (1) | |
# On crée un dossier assets et son sous-dossier css | |
mkdir -p assets/css | |
# Dans le dossier css on crée le fichier master.css vide | |
touch assets/css/master.css | |
# Qu'on remplira d'un squelette de page css (1) | |
# On indexe le tout : | |
git add -A | |
# On commit le tout : | |
git commit -m "commit initial" | |
# Et on push : | |
# Dabord demandons le username de git : | |
read -p 'Entrez votre nom : ' nom | |
# Puis on cree le repo distant : | |
curl -u $nom https://api.github.com/user/repos -d '{"name":"'$1'"}' | |
# On defini a quel endroit on veut pousser : | |
git remote add origin [email protected]:$nom/$1.git | |
# Et on push avec le -u signalant que c'est le upstream : | |
git push -u origin master | |
# Notes | |
# (1) = script a créer ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment