0%

Create Git Repository

Steps

Create Repository at Github website.

Img

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.

Initialize local repository

script
1
2
3
git init -b main
# Add .gitignore file.
git add . && git commit -m "First commit"

Bind local and remote repository

Img

script
1
2
3
4
git remote add origin  <REMOTE_URL> 
# Sets the new remote
git remote -v
# Verifies the new remote URL

Authentication

Generate token as following:
Img

Use token:

script
1
git remote set-url origin https://<generated_token>@github.com/<user-name>/<remote_repository_name>.git

Push to remote

script
1
git push -u origin main