Tuesday, 30 November 2021

2021 GIT add multiple remote

 https://stackoverflow.com/questions/11690709/can-a-project-have-multiple-origins


git remote add <remote_name> <remote_url.git>

git remote -v <list of remote>

git remote remove <remote_name>


git push <remote_name> <remote_branch_name>

*Note altough new remote added, git local branch still tracks from current remote not new remote, unless set remote origin or other commands are used

$ git remote add github https://github.com/Company_Name/repository_name.git

# push master to github
$ git push github master

# Push my-branch to github and set it to track github/my-branch
$ git push -u github my-branch

# Make some existing branch track github instead of origin
$ git branch --set-upstream other-branch github/other-branch

No comments:

Post a Comment