This is very simple If you have already set a remote origin url then you use
set-url
command to change that, otherwise simply useadd
command
git remote -v
Check if any remote already existsgit remote set-url origin [email protected]:User/UserRepo.git
to change the origingit remote add origin [email protected]:User/UserRepo.git
to set new origin for your repo.git push -u origin master
to push your code to remote and add upstream (tracking) reference to your remote branch.NOTE: If you use -u
flag, its for upstream, it enables you to use simply git pull
instead of git pull origin <branch-name>
in upcoming operations.
Happy Coding ;)