简体   繁体   中英

How can i push one branch in diffeent remote repo in git

I am working on a project where we have one master branch and locally we have separate branch called testing

Currenty i can only push to master branch and my team lead told me not to push my branch on remote repo server.

This is my git config

 [core]
  2     repositoryformatversion = 0
  3     filemode = true
  4     bare = false
  5     logallrefupdates = true
  6 [remote "origin"]
  7     fetch = +refs/heads/*:refs/remotes/origin/*
  8     url = https://user@mydomain/myrepo
  9 [branch "master"]
 10     remote = origin
 11     merge = refs/heads/master
 12 [user]
 13     email = xxxx
 14     name = xxxxx

Is there any way that i can also link this project to my other remote repo on bitbucket so that i can also push my branch changes to bitbucket.

Also can i have both master and testing branch commits on bitbucket and my company server as well

Adding another remote repo is simple, however, as Chris Hayes points out , you should check to see if this is okay with your company first.

Assuming that it's OK, you simply add the remote url for the BitBucket repository, and push to it:

git remote add bitbucket <bitbucket-repo-url>
git push bitbucket master testing

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM