61

Is it possible to use GitHub for Windows for both Bitbucket and GitHub at once?

For example, can I have repo on both sites show up in the program, and when I commit/synch a repo, it push to the respective repo on the respective website?

random
  • 9,324
  • 10
  • 63
  • 77
Chin
  • 16,446
  • 27
  • 96
  • 148

3 Answers3

84

No, if you mean: having a local repo with two remotes (one GitHub and one Bitbucket).
You can define only one remote with that client, and it will be either a GitHub one or a Bitbucket one.


Yes, if you limit to one remote, you can use GitHub for Windows with any upstream repo.

The process of adding an upstream repo is now easier with the (constantly) updated GitHub for Windows app:

select the URL and then drag the text from your browser, and drop it into the GitHub for Windows app. It will automatically add the repository.

draganddrop


(Original answer February 2013)

In order for "GitHub for Windows" to publish (instead of "pushing to GitHub"), you need to define a remote "origin" (in the settings of your local repo) using the https address of the Bitbucket repo:

https://user@bitbucket.org/user/repo

So if you create a local repo through "GitHub for Windows", you can add, through its settings, the right remote:

remote

Note that the first refresh will trigger a login screen, in order for you to enter your http credential you are using on bitbucket.org: they will be cached (and encrypted) by GitHub for Windows for the duration of your current session.

login

(See "Password Caching" and "git: 'credential-cache' is not a git command", for more on that credential caching mechanism, recently introduced with Git 1.7.9+)

Any modification you are doing locally will be picked up by the GitHub for Windows client (you might need to exit the repo (left arrow in the top left corner of the GitHub for Windows client, and click again on your local Bitbucket repository: that will trigger a refresh):

commit

The key in the next screenshot is in the word "publish" (instead of "push to GitHub").
That is because the remote "origin" is an https one.

publish in GitHub app

Click on "publish" and you will see your repo status set to "in sync":

in sync

Rush to bitbucket.org to check if, indeed GitHub for Windows did push to Bitbucket:

published

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • I'm sorry, I'm new to this and I don't quite understand the steps, can you please provide the in-depth steps? I already had `GitHub for Windows` installed – Chin Dec 02 '12 at 00:15
  • 1
    @Chin After test, I have amended my answer. You cannot have one local repo which could pull from/push to/pull from *two* different upstream repos (one GitHub and one BitBucket). But you can certainly push to any upstream repo you like, provided you are using one https-defined upstream repo (BitBucket or any other). – VonC Dec 02 '12 at 01:22
  • exactly what I'm looking for (different site for different repo). Thanks a lot! – Chin Dec 02 '12 at 02:20
  • @drzaus by using the right `user.name` and `user.email` when pushing to the upstream repo. – VonC Feb 07 '13 at 14:21
  • @VonC ah thanks, just found that out -- you have to set it globally using the included bash/powershell: `git config --global user.name "FIRST LAST"` and `git config --global user.email "whatever"` – drzaus Feb 07 '13 at 14:43
  • When I select the URL and go hover it over the `drag a repository here to add` blue box, the mouse icon becomes ⃠ and I can't add it. – Nicolas Raoul Jun 05 '13 at 11:40
  • @NicolasRaoul I just tried it, with a fresh 'GitHub for Windows' installation: it works well with an https url, it doesn't with an ssh. Did you url start with `ssh://`? – VonC Jun 05 '13 at 15:46
  • I am pretty sure I was using an https://xxx/xxx.git URL... but I tried again and it worked with URL `https://user@bitbucket.org/user/repo.git` as you wrote, thanks and sorry for the noise! – Nicolas Raoul Jun 06 '13 at 03:34
  • Gotcha! use http/https instead of ssh – Vincent Mar 18 '14 at 05:56
  • @VonC Any idea how to get PullRequest working? The option is not available for me when using a remote repo. – ChrisB Sep 16 '16 at 06:15
  • @ChrisB PullRequest working when using BitBucket instead of GitHub? – VonC Sep 16 '16 at 06:16
  • @VonC Yes exactly. I am missing this option in the GUI when using my BitBucket repo: http://i.imgur.com/slA6TVY.png – ChrisB Sep 16 '16 at 06:23
  • @ChrisB OK. It is best to make that a new questions, for others to chime in. – VonC Sep 16 '16 at 06:27
  • @VonC Yes, i agree. http://stackoverflow.com/questions/39525102/github-for-windows-pull-request-for-remote-bitbucket-rpeo – ChrisB Sep 16 '16 at 06:34
14

There is also a new windows client that you can use with bitbucket. I tried it today and i think it is a better product.

http://www.sourcetreeapp.com/

Nikos Tsokos
  • 2,995
  • 2
  • 31
  • 40
13

There is now an even easier way to get GitHub for Windows to connect to your Bitbucket account. Check out the link below.

http://www.infragistics.com/community/blogs/david_burela/archive/2013/03/31/using-the-github-for-windows-app-with-bitbucket.aspx

Community
  • 1
  • 1
zA.
  • 381
  • 4
  • 10
  • Interesting. +1. I have included a reference to that blog post in my answer above for more visibility. – VonC May 31 '13 at 05:29