# Bash script : create a hugo website in seconds with that bash script ## Pre-requisite: a. install Hugo b. install Git c. install unzip ## Step-by-step: **1. Choose a Hugo theme on** https://themes.gohugo.io **2. Click on the theme page, and click on the "download" button: you will land on a github repository page (a page that starts with https://github.com.......)** *for example: Hugo creative portfolio* **3.Click on the top right green button called "clone or download" > right click on the "download zip" button, and click on "copier l'adresse du lien " > then run the command:** **4. Change the current working directory to the location where you want to create your new repository.** *for example, on my computer:* `cd ~/Bureau/TOUT/Websites_and_Apps` **5. Create a subdirectory for your new Hugo website** `Hugo new site Site_web_de-l-enfance` **6. Go into the /themes subsubdirectory:** `cd ~/Bureau/TOUT/Websites_and_Apps/themes` **7. Download-rename doznloaded file, and unzip the repository of the Hugo theme with the following command:** ``` wget https://github.com/kishaningithub/hugo-creative-portfolio-theme/archive/master.zip & ``` * (*7. Change your current working directory to the "theme" directory (it should contain your newly cloned Hugo theme directory):* ``` cd /themes ``` 7.bis `unzip *` 7.ter `mv * hugo-creative-portfolio-theme` * (*8. To filter out the subfolder from the rest of the files in the repository, run git filter-branch, supplying this information: FOLDER-NAME: The folder within your project that you'd like to create a separate repository from. BRANCH-NAME: The default branch for your current project, for example, master or gh-pages.* `git filter-branch --prune-empty --subdirectory-filter FOLDER-NAME BRANCH-NAME ` *Filter the specified branch in your directory and remove empty commits : > Rewrite 48dc599c80e20527ed902928085e7861e6b3cbe6 (89/89) > Ref 'refs/heads/BRANCH-NAME' was rewritten The repository should now only contain the files that were in your subfolder.)* **9. Move to the root of your Website project folder :** *for example:* `cd ../..` **10. Make it a Git versionable project, to be able to follow the differents modifications that the website will have across its evolution.** `git init` You receive that message as a positive result : " Dépôt Git existant réinitialisé dans /home/habsinn/Bureau/TOUT/Websites_and_Apps/Site_web_de-l-enfance/.git/ " **11. Create a new repository on GitHub.** **12. At the top of your new GitHub repository's Quick Setup page, click to copy the remote repository URL field (choose HTTPS).** *Tip: For information on the difference between HTTPS and SSH URLs, see "Which remote URL should I use?" Check the existing remote name for your repository. For example, origin or upstream are two common choices.* **13. Set up a new remote URL for your new repository the remote repository URL you copied in step 12.** `git remote add origin https://github.com/habsinn/de_l-enfance_FR.git` **14. Verify that the remote URL has changed with your new repository name.** `git remote -v` *Verify new remote URL:* > origin https://github.com/habsinn/de_l-enfance_FR.git (fetch) > origin https://github.com/habsinn/de_l-enfance_FR.git (push) **16. Push your changes to the new repository on GitHub.** `git push -u origin BRANCH-NAME` ## ERREURS Tentative de solutionner erreur, dans l'ordre: *error: impossible de pousser des références vers 'https://github.com/habsinn/del-enfanceFR.git'* git rm -f --cached themes/hugo-creative-portfolio-theme git add . git commit -m " " git push -u origin master cd ~/Bureau/TOUT/Websites_and_Apps/TEST/themes/hugo-creative-portfolio-theme rm -rf .git rm -rf .gitignore dans le sous-module 'themes/hugo-creative-portfolio-theme' non populé [hugo blog theme](https://fabform.io/a/hugo-blog-theme)