At the moment I'm planning to write a python template for my company in order to have a consistent structure through all the different projects and channel some best practices.
To do so it seems a good idea to use the Cookiecutter method of generating templates on the one hand and the GitHub Template repository feature on the other hand. Now I'm curious if one can combine both methods, I have something like this in my mind:
Is it possible to use such a workflow? How would I do it?
Of course it would be even cooler if GitHub could integrate Cookiecutter in its GitHub Template repository feature; like asking you all the question within the website.
I had the same task. Following this post (that is for gitlab, for github is a bit different), this workflow worked for me:
cookiecutter-test
) and the repository link (e.g. https://github.com/nepentabits/cookiecutter-test.git)cookiecutter-test
)$ cookiecutter https://xx@dev.azure.com/xx/ama-template-data-science
$ ...
$ ls
$ cookiecutter-test
cookiecutter-test
) and perform the git
commands exactly in the same order. This is due to the fact that in most git local installations the branch is called master
while in github they call it main
, and for changing branch names in local, you have to have a commit first. Also, this works if the github repo is completely empty. Substitute$ git init
$ git add .
$ git commit -m "First commit with cookiecutter scaffold"
$ git branch -M main
$ # the repo link should yours one
$ git remote add origin https://github.com/nepentabits/cookiecutter-test.git
$ git push -u origin main
In the last step will ask you for your github name and https token.