Create GitHub First Push#
Pre-requisites#
A GitHub account.
Tutorial#
GitHub Local Repository CLI Push Options#
After creating your GitHub repository and cookiecutter-py3-package, you have several options to get your package initialised and pushed into your repository.
Important
Replace imAsparky/my-new-django.git with <your-repo-name>/<your-package-name>.git
Using Default Settings#
If you have used the default package creation setting:
automatic_set_up_git_and_initial_commit [y]:
Getting ready for your first push to GitHub is quite simple.
You will have a folder structure similar to this.
projects
├── my-new-django
└── my_env
cd my-new-django
You will have a folder structure similar to this.
my-new-django
├── .git
├── .github
├── .pre-commit-config.yaml
├── .pyup.yml
├── .readthedocs.yaml
├── CHANGELOG.md
├── LICENSE.rst
├── README.rst
├── docs
├── manage.py
├── my_new_django
└── requirements_dev.txt
Check git status.
git status
You will see CLI output similar to this.
On branch main
nothing to commit, working tree clean
Check git reflog.
git reflog
You will see CLI output similar to this.
Notice the commit message “chore(git): Initial Commit”
b5b47be (HEAD -> main) HEAD@{0}: commit (initial): "chore(git): Initial Commit"
Now you can push your new package to GitHub.
git push -u origin main
You will see CLI output similar to this.
Enumerating objects: 48, done.
Counting objects: 100% (48/48), done.
Compressing objects: 100% (40/40), done.
Writing objects: 100% (48/48), 15.59 KiB | 939.00 KiB/s, done.
Total 48 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (2/2), done.
To github.com:imAsparky/my-new-django.git
* [new branch] main -> main
Branch 'main' set up to track remote branch 'main' from 'origin'.
Navigate to your GitHub my-new-django repository and it will look something like this.
GitHub Alternative Options#
Here are the other options provided by GitHub.
Quick setup — if you’ve done this kind of thing before.
git clone https://github.com/imAsparky/my-new-django.git
git clone git@github.com:imAsparky/my-new-django.git
git init
git add -A
git commit -m "chore(git): Initial Commit"
git branch -M main
git remote add origin git@github.com:imAsparky/my-new-django.git
git push -u origin main
git remote add origin git@github.com:imAsparky/my-new-django.git
git branch -M main
git push -u origin main
This option is not supported here.
Whats next?#
Check out our other Tutorials for more information on how to get the most out of your cookiecutter package.