5

I develop code in Bazaar and want to publish it on Github. What is the best way to achieve this?

It is OK if the solution only provides a way to push just one branch in the Bazaar repository to Github.

Thomas Bach
  • 157
  • 1
  • 8

3 Answers3

2

Use the bzr-git plugin which should be bundled with recent versions of bzr.

dOxxx
  • 1,540
  • 1
  • 12
  • 28
  • 2
    ``bzr dpush`` can do this for you if you have bzr-git installed. Note that you'll have to specify the URL of the github repository (git+ssh://git@github.com/user/repo/) rather than the shorthand (git@github.com:user/repo). – jelmer Aug 20 '12 at 21:32
  • I already tried `bzr dpush`. It does some kind of rebase-thingy. I was spending one hour resolving the conflicts that resulted from that. As far as I understood it, the use-case of bzr-git is to provide a bazaar-like view on an actual git-tree. – Thomas Bach Aug 23 '12 at 12:53
  • Git cannot persist all of the metadata in Bazaar revisions, so (if I understand correctly) the dpush command essentially pushes new commits to the git repository with diffs for each bzr revision and then does a pull/rebase on the bzr repository to synch it with the state of the git repository. – dOxxx Aug 23 '12 at 13:53
  • @jelmer I tried that and got `bzr: ERROR: Unsupported protocol for url`. – BrainSlugs83 Oct 10 '14 at 02:35
  • 1
    @BrainSlugs83 Do you have bzr-git installed (is it listed by "bzr plugins"?), and are you using a git+ssh:// URL? – jelmer Oct 17 '14 at 06:29
  • `bzr plugins` says I have `git 0.6.8` installed (I have not installed any plugins manually, just using the default that comes with a full Windows install). Using `git+ssh` as the protocol (as you suggested in the comments above) is when I get the specific error mentioned. `git+ssh://` just plain doesn't work. Using `https` as the protocol (as suggested in my answer below) works great, however. – BrainSlugs83 Oct 18 '14 at 22:59
1

As of Bazaar 2.5.1, the correct syntax for bzr dpush (part of the git plugin which is installed by default on Windows) is:

bzr dpush https://github.com/myUserName/myProject.git/,branch=master

For the URL, just put the same exact "HTTPS clone URL" that github gives you for pulling down the repository (it's on the far right of the main repository page, if you search the page for "HTTPS clone URL" you should see it).

This will prompt you for your password every single time you use it. If that becomes a hassle, I recommend creating an authentication.conf file (storing it in bzr's HOME folder -- that is "%appdata%\bazaar\2.0" on Windows). You'll want to encrypt the file as well (even on a non-shared machine), since it will have your password in it as plain text * shudder *.

The following worked for me:

[github.com]
scheme=https
host=github.com
user=myUserName
password=myPassword
BrainSlugs83
  • 6,214
  • 7
  • 50
  • 56
-1

Use git-bzr-ng (a bidirectional bridge between git and bzr).

Erre Efe
  • 15,387
  • 10
  • 45
  • 77
  • Could you provide an example? To me it seems like git-bzr-ng is rather assuming to work on a git repository with the ability to push to push to bazaar. – Thomas Bach Aug 18 '12 at 17:18