github connect to remote repository code example

Example 1: connect local repository to remote git

git remote add origin <remote repository URL>
# Sets the new remote
git remote -v
# Verifies the new remote URL
git push origin master

Example 2: git push existing repo

cd existing_folder
git init
git remote add origin https://gitlab.com/abc.git
git add .
git commit -m "Initial commit"
git push -u origin master

Example 3: github add new origin

git init .
git remote add origin <http/someURL>
git pull origin master

Example 4: git connect to remote repository

git init
git commit -m "[message]"
git remote add origin "github repository link"
git push -u origin master