how to set git repository to github code example

Example 1: set up git repository

# New local repository
git init
git add .
git commit -m "Initial commit"

# New remote repository
# Create remote repository (likely on github), then:
git remote add origin https://github.com/username/new_repo #https
git remote add origin [email protected]:username/new_repo #ssh
# Now push
git push -u origin master

Example 2: pushing to github

git add .
git commit -m "First commit"
git push origin master

Example 3: git create github repo

git init
git add .
git commit -m 'Initial commit'
gh repo create # => With the new GitHub CLI

Example 4: how to add a repository to github

git & github

Tags:

Misc Example