rake release fail (using gem bundler)

I published my first rubygem here: https://rubygems.org/gems/blomming_api
(source code here: https://github.com/solyaris/blomming_api)

I used bundler, that create three rake tasks with bundle gem command:

  • how to automatically run bundle install if the gemfile is updated after a git pull/merge?
  • using bundler to load different versions of gems for different platforms
  • Bundler: always use latest revision of git branch in Gemfile
  • How to force the update of a gem with bundler?
  • No such file or directory - git ls-files
  • Why doesn't the command `gem list` include gems installed with bundler's :git option?
  • $ rake -T
    rake build    # Build blomming_api-0.3.7.gem into the pkg directory
    rake install  # Build and install blomming_api-0.3.7.gem into system gems
    rake release  # Create tag v0.3.7 and build and push blomming_api-0.3.7.gem to Rubygems

    All fine if install locally the gem with rake install:

    $ rake install
    blomming_api 0.3.7 built to pkg/blomming_api-0.3.7.gem.
    blomming_api (0.3.7) installed.

    The problem arise when I try to release:

    $ rake release
    blomming_api 0.3.7 built to pkg/blomming_api-0.3.7.gem.
    Tagged v0.3.7.
    Untagging v0.3.7 due to error.
    rake aborted!
    Couldn't git push. `git push  2>&1' failed with the following output:
    fatal: No configured push destination.
    Either specify the URL from the command-line or configure a remote repository using
        git remote add <name> <url>
    and then push using the remote name
        git push <name>
    /home/solyaris/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/gem_helper.rb:104:in `perform_git_push'
    /home/solyaris/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/gem_helper.rb:96:in `git_push'
    /home/solyaris/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/gem_helper.rb:77:in `block in release_gem'
    /home/solyaris/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/gem_helper.rb:129:in `tag_version'
    /home/solyaris/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/gem_helper.rb:77:in `release_gem'
    /home/solyaris/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/gem_helper.rb:50:in `block in install'
    Tasks: TOP => release
    (See full trace by running task with --trace)

    Nevertheless I’m able to publish the gem with successfull gem push command:

    $ gem push pkg/blomming_api-0.3.7.gem
    Pushing gem to https://rubygems.org...
    Successfully registered gem: blomming_api (0.3.7)

    I presume that problem is on the git push remote configuration…
    Any idea to help me configure git to let rake release run ?

    BTW, I already configured my rubygems credentials on /home/solyaris/.gem
    and git push on github run ok.
    I know… my git reluctance is big 😉

  • GitK shows remote/origin/master as behind master, but git status and other commands insist that everything is up to date
  • i cloned a git repo and see strange texts in files. HEAD <<< and >>>>>
  • How do I make Git use the editor of my choice for commits?
  • How do Git LFS and git-annex differ?
  • Rename remote git branch without fetch
  • How can Git track a file in your repo but not overwrite it from someone else's branch?
  • 2 Solutions collect form web for “rake release fail (using gem bundler)”

    The command rake release attempts to push the code to the remote repository (implicitly assuming you’re using git) and create a tag.

    In your case, it looks like there is no git remote configured for your repository and the task fails.

    I personally don’t like such task. I tend to use

    $ rake build

    to build the package, then

    $ gem push pkg/...

    to publish the gem to RubyGems.

    If you want to use rake release I suggest you to override the default implementation to skip/replace/customize the Git commit.

    rake release will attempt to tag your gem in git and push it to your remote. Sounds like you aren’t configured to do git push without specifying the remote.

    Try this to fix: git push -u origin master

    If you can do git push after that without an error, rake release should work as well, although you might need to bump the version number of your gem if you’ve already pushed it to ruby gems, as I think ruby gems complains if you try to release a gem of the same version.

    Git Baby is a git and github fan, let's start git clone.