# File lib/r10k/git/rugged/bare_repository.rb, line 45
  def fetch
    backup_branches = wipe_branches
    logger.debug1 { "Fetching remote 'origin' at #{@path}" }
    options = {:credentials => credentials}
    refspecs = ['+refs/*:refs/*']
    results = with_repo { |repo| repo.fetch('origin', refspecs, options) }
    report_transfer(results, 'origin')
  rescue Rugged::SshError, Rugged::NetworkError => e
    restore_branches(backup_branches)
    raise R10K::Git::GitError.new(e.message, :git_dir => git_dir, :backtrace => e.backtrace)
  rescue
    restore_branches(backup_branches)
    raise
  end