Links: git MOC



Create New Git Repo For Nodejs Project

links: sample gitignore nodejs project, How to Create a New Git Repository | Start a Github Repo

mkdir project
git init 
touch .gitignore
# add patterns to gitignore file
git add. 
git commit -m "initial commit"
git ls-tree -r master --name-only

# create repo in github
git remote add origin URL
git branch -M main
git push -uf origin main


The command git branch -M main is often used to rename the default "master" branch to "main", but note you must have at made at least 1 commit in your repo for this to work

Check Existing Remote URL

git remote -v

Change Existing Remote URL

# Remove the existing remote URL
git remote remove origin

# Add the new remote URL
git remote add origin