Create a new repository on GitHub (in my case git-and-bash-aliases
).
To avoid errors, do not initialize the new repository with README
, license
, or gitignore files. You can add these files after your project has been pushed to GitHub.
$ git clone [email protected]:09912ca4188a4ba3c610d7f61c200c38.git git-and-bash-aliases
$ cd git-and-bash-aliases
With the
git clone
command, the folder will be named by default with the gist reference (in this case09912ca4188a4ba3c610d7f61c200c38
).I prefer to give my folder a more explicit name to make it easier to find my way around my gists.
remote | target |
---|---|
origin | new GitHub repository |
gist | original gist repository |
$ git remote -v
origin [email protected]:09912ca4188a4ba3c610d7f61c200c38.git (fetch)
origin [email protected]:09912ca4188a4ba3c610d7f61c200c38.git (push)
$ git remote rename origin gist
$ git remote -v
gist [email protected]:09912ca4188a4ba3c610d7f61c200c38.git (fetch)
gist [email protected]:09912ca4188a4ba3c610d7f61c200c38.git (push)
$ git remote add origin [email protected]:jprivet-dev/git-and-bash-aliases.git
$ git remote -v
gist [email protected]:09912ca4188a4ba3c610d7f61c200c38.git (fetch)
gist [email protected]:09912ca4188a4ba3c610d7f61c200c38.git (push)
origin [email protected]:jprivet-dev/git-and-bash-aliases.git (fetch)
origin [email protected]:jprivet-dev/git-and-bash-aliases.git (push)
$ git branch -M main
$ git push -u origin main
That's all ¯_(ツ)_/¯
FYI, you can save yourself the trouble and use GitHub's import tool:
hat tip to @rolfen