skip to content
Keshav Mohta

Change git source repo in local and remote

/ 1 min read

Add/update git repo url

  1. initialize git in the project root
Terminal window
git init

.git folder will be generated in project root using above command

  1. if .git folder already exist then check whether remote url exist using
Terminal window
git remote -v
  1. to add repository url by copying using github.com and copy and clone option ( keep https or ssh ; depends on your choice and config )
Terminal window
git remote add origin <https://github.com/user/repo.git>
  1. to update the remote URL
Terminal window
git remote set-url origin < https://github.com/user/repo.git>
  1. check again using git remote -v