github init code example

Example 1: git push current project to master

git init
git add .
git commit -m 'First commit'
git remote add origin <remote repository URL>
git push origin master

Example 2: add github repo

create a new repository on the command line
echo "# {Repo Name}" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/cdcdianne/ReactJS-TheMovieDB.git
git push -u origin main
                
push an existing repository from the command line
git remote add origin https://github.com/cdcdianne/ReactJS-TheMovieDB.git
git branch -M main
git push -u origin main

Example 3: git push new repo to remote

$ git remote add origin <remote repository URL>
# Sets the new remote

# Push the changes in your local repository to GitHub.
$ git push -u origin master
# Pushes the changes in your local repository up to the remote repository you specified as the origin

Example 4: create new repository on the command line

git init
git add README.MD
git commit -m "commit message"
git remote add origin git url_of_github_repo
git push origin master

Example 5: git init

cd /path/to/my/codebase
git init   
git add .    
git commit -m "my comment"

Example 6: git init

cd /path/to/my/codebase
git init   
git add .    
git commit -m "my comment"