Last Updated on 15/11/2020
This post will show how to share a local project on GitHub in a few easy steps using the command line and a few actions taking on GitHub’s website.
Create and init your local GitHub repository
- Go to https://github.com and create the repository for your project;
- When prompted by GitHub, init your new repository so a new master branch is created.
Sync the local and remote repositories
Init your project root folder as a Git repository:
git init
Add the remote GitHub repository to your local Git repository:
git remote add origin https://github.com/<github_user>/<github_project>.git
Fetch the remote branches:
git fetch origin
Checkout and set the master’s branch to point to the remote branch:
git checkout -b master --track origin/master
Hope it helps. Cya!
References
- Stack Overflow – What’s the best practice to “git clone” into an existing folder?