ddollar/heroku-accounts

'fatal: Not a git repository (or any of the parent directories): .git' at top of every Heroku shell response

mmccroskey opened this issue · 9 comments

After installing heroku-accounts, every time I call the toolbelt from the command line, its response begins with fatal: Not a git repository (or any of the parent directories): .git. Uninstalling the toolbelt fixes the issue.

My version is heroku-toolbelt/2.30.3 (universal-darwin11.0) ruby/1.8.7.

@mmccroskey - so removing heroku-accounts fixed this, or removing toolbelt did? heroku-accounts tries to detect its default in a way that might cause this, but just wanted to make sure I followed.

heroku plugins:uninstall heroku-accounts uninstalls heroku-accounts successfully, and fixes the issue. I went back and forth several times; while heroku-accounts is installed, the issue persists, and once it's uninstalled, the issue goes away.

Lemme know if I can provide more detail.

@mmccroskey - I think if you do touch ~/.gitconfig it should stop displaying that error. Also the error should be relatively harmless, albeit annoying.

it doesn't stop displaying that error once you touch ~/.gitconfig

I installed the plugin and modified the file lib/accounts/heroku/command/base.rb

On line 7 I added the following: return unless File.exists?(".git")

Below it 'git remote' is called and this overrides the git_remotes in Heroku::Command::Base, you may not be in a git directory when calling the heroku commands which would explain why git was complaining, if you try calling the heroku commands in a git repo directory you'll see it won't show that error, anyways I added that check and it works fine now for me

File looks like this on my machine:

require "heroku/command/base"

class Heroku::Command::Base

  def git_remotes(base_dir)
    remotes = {}
    return unless File.exists?(".git")
    FileUtils.chdir(base_dir) do
      remote_names = %x{ git remote }.split("\n").map { |r| r.strip }
      remote_names.each do |name|
        case %x{ git config remote.#{name}.url }
          when /git@#{heroku.host}:([\w\d-]+)\.git/  then remotes[name] = $1
          when /git@heroku.[\w\d-]+:([\w\d-]+)\.git/ then remotes[name] = $1
        end
      end
    end

    remotes
  end

end

Forked it and tested, seems to work ok, you can try it out here: https://github.com/marchinram/heroku-accounts.git

@marchinram Thanks Brian, I'll try that out and let you know how it goes.

heroku plugins:uninstall heroku-accounts worked for me. thanks a bunch, saved my life!

Hello. I apologize for the delayed response. I am currently declaring issue bankruptcy. If this issue still applies to you please feel free to re-open and explain. Thanks :)

After creating app using heroku create app name, here is the problem. When I type "git add .", then this error is appearing, I can't proceed further.
Please help me fix this.
Thanks,
Sai Likhith