A git repository is present in local (or somewhere on the net) but it is not in github.
We want to replicate the commit history (and all branches) in github.
Refer to https://help.github.com/en/articles/importing-a-git-repository-using-the-command-line
- Create a bare clone
git clone --bare path/to/local/git/repository.git
-
Create a github repository (via GUI)
-
Push (mirror) the bare clone to github
cd repository.git
# assuming authetication public key etc are set up in github
git push --mirror /path/to/github/url
All history (commits and branches) are cloned in github.