Create a Repo in your Github space. Add a Readme and a License (the MIT License is what I like to use).
At the same time, create a new local directory (folder) in your computer, wherever you want.
- Step 1: In Bash, navigate to your newly created folder with the cd command
- Step 2: Initialize Git in this new project folder
git init
- Step 3: Add your remote pointer for this folder
git remote add origin https://github.com/your_github_page/your_new_repo_name
- Step 4: Check that the pointer is ok by doing
git remote -v
- Step 5: If the pointer is ok, fetch the changes from the remote (the license and the readme files)
git fetch origin
- Step 6: Merge your local changes (empty directory) with the remote fetched files
git merge origin/main
- Step 7 (optional): If you already added some files to your local directory you may need to force the merge
git merge origin/main --allow-unrelated-histories
- Step 8: To push the current branch and set the remote as upstream
git push --set-upstream origin main
You're ready to go now!