Hsiu Chuan Tsao
Hsiu Chuan Tsao

Reputation: 1586

fatal: Not a git repository (or any of the parent directories): .git when "bundle install"

I have a directory that exists in a Gemfile.

When I execute bundle install in the directory, it shows this warning message:

fatal: Not a git repository (or any of the parent directories): .git 

but if I execute git init in the directory first, it does not show this warning message.

I know it's about the directory is it a git repository? But it doesn't make sense.

Why execute bundle install in the directory and need the directory to become a git repository first?

Upvotes: 5

Views: 4748

Answers (2)

eQ19
eQ19

Reputation: 10711

I have been struggling with that fatal warning. Finally I found that your comment of bundle install is correct.

I find the issue, because there is exist external include gem file that its gemspec file use the syntax git ls-files

enter image description here

The syntax on my gemspec file

spec.files = `git ls-files -z`.split("\x0").
select { |f| f.match(%r!^(assets|_layouts|_includes|_sass|LICENSE|README)!i) }

By uncomment git ls-files the warning is gone:

enter image description here

Upvotes: 2

Keshan Nageswaran
Keshan Nageswaran

Reputation: 8188

There is a bug for Bundler in older version, which could be related: https://github.com/carlhuda/bundler/issues/2039

Definitely not a problem with git or your git repo. Try updating bundler. latest stable version of bundler would fix this issue

Upvotes: 4

Related Questions