ruby/rubygems · error · DeprecatedError

You can no longer specify a git source by itself. Instead,

Error message

You can no longer specify a git source by itself. Instead, 
either use the :git option on a gem, or specify the gems that 
bundler should find in the git source by passing a block to 
the git method, like: 

  git 'git://github.com/rails/rails.git' do
    gem 'rails'
  end

What it means

Error "You can no longer specify a git source by itself. Instead, either use the :git option on a gem, or specify the gems that bundler should find in the git source by passing a block to the git method, like: git 'git://github.com/rails/rails.git' do gem 'rails' end" thrown in ruby/rubygems.

Source

Thrown at lib/bundler/dsl.rb:184

        "root_path" => gemfile_root
      )

      source_options["global"] = true unless block_given?

      source = @sources.add_path_source(source_options)
      with_source(source, &blk)
    end

    def git(uri, options = {}, &blk)
      unless block_given?
        msg = "You can no longer specify a git source by itself. Instead, \n" \
              "either use the :git option on a gem, or specify the gems that \n" \
              "bundler should find in the git source by passing a block to \n" \
              "the git method, like: \n\n" \
              "  git 'git://github.com/rails/rails.git' do\n" \
              "    gem 'rails'\n" \
              "  end"
        raise DeprecatedError, msg
      end

      with_source(@sources.add_git_source(normalize_hash(options).merge("uri" => uri)), &blk)
    end

    def github(repo, options = {})
      raise InvalidArgumentError, "GitHub sources require a block" unless block_given?
      github_uri  = @git_sources["github"].call(repo)
      git_options = normalize_hash(options).merge("uri" => github_uri)
      git_source  = @sources.add_git_source(git_options)
      with_source(git_source) { yield }
    end

    SUPPORTED_OVERRIDE_FIELDS = [:version, :required_ruby_version, :required_rubygems_version].freeze
    SUPPORTED_OVERRIDE_SYMBOL_OPERATIONS = [:ignore_upper].freeze

    def override(target, **operations)
      validate_override_target!(target)

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/bundler/dsl.rb:184 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruby/rubygems@86cbb817a3 (2026-08-23). Data as JSON: /api/errors/b15c13d9bb62a954. Report an issue: GitHub.