Capistrano failing with fatal: Not a git repository

712 views
Skip to first unread message

Nicholas Wieland

unread,
Sep 30, 2014, 11:01:20 AM9/30/14
to capis...@googlegroups.com
Versions:
  • Ruby 2.1.1
  • Capistrano 3.2.1
  • Rails 3.2.17 / Rake 10.3.1
Platform:
  • Working on OS X Mavericks
  • Deploying to #58-Ubuntu 3.2.0-37-virtual 
Logs:
I'm having a problem deploying my Rails app on my staging environment.

The error message I get is "fatal: Not a git repository" which doesn't really make sense to me.

This is the output Capistrano returns when I run it: https://gist.github.com/ngw/8a6f357fefedcc6354b8

I searched for a solution and I tried pretty much everything, I even tried to completely remove the application directory and deploy again from scratch.
I tried to repeat the commands that fail directly on the server, and again I have "fatal: Not a git repository", for example:

    cd /home/deployer/apps/XXXX/current && ~/.rvm/bin/rvm 2.1.1 do bundle exec sidekiqctl quiet /home/deployer/apps/XXXX/shared/tmp/pids/sidekiq.pid
    fatal: Not a git repository (or any of the parent directories): .git


I've tried to switch branch to a production branch that deployed just fine a couple of hours before with no changes: same problem.

I absolutely have no idea how to debug this.
Any suggestion is highly appreciated.

It doesn't seem there's a problem interacting with the repo on github, but with the local environment. I think what it's complaining about is that the project directory isn't a git repository, which doesn't even make sense to me...

TIA,
  ngw

Lee Hambley

unread,
Sep 30, 2014, 2:03:20 PM9/30/14
to capistrano
The `fatal: not a git repository` isn't what is blowing up your deloyment, it seems like many of those are streaming out of tools such as bundler, and sidekiq which probably try and do something like grab the HEAD sha hash, for log messages or something.

From the logs posted, I actually can't see what is failing either, sorry that's not more helpful. 

If you can, please try SSHKit from master, you can specify the `git: ........` URL in your Gemfile, and it should default to the tip of the master branch, from there you might get better error logging (well, I know for sure you will, I just hope it shows more about why your deployment is failing)

--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/4e0c168b-8c4a-480b-8c38-5c70bc0bd5ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nicholas Wieland

unread,
Oct 1, 2014, 5:03:12 AM10/1/14
to capis...@googlegroups.com
On Tuesday, September 30, 2014 8:03:20 PM UTC+2, Lee Hambley wrote:
The `fatal: not a git repository` isn't what is blowing up your deloyment, it seems like many of those are streaming out of tools such as bundler, and sidekiq which probably try and do something like grab the HEAD sha hash, for log messages or something.

From the logs posted, I actually can't see what is failing either, sorry that's not more helpful. 

If you can, please try SSHKit from master, you can specify the `git: ........` URL in your Gemfile, and it should default to the tip of the master branch, from there you might get better error logging (well, I know for sure you will, I just hope it shows more about why your deployment is failing)

Ok, I managed to debug this not by upgrading SSHkit (the output was pretty much the same than before) but by running all commands one by one.
Now my deploy runs just fine, finally, thanks a lot for your help.
I still have that "fatal: not a git repository" error, how can I get rid of it? I have no idea what it is.

  ngw

Lee Hambley

unread,
Oct 1, 2014, 5:18:31 AM10/1/14
to capistrano
I'm not sure either where it comes from, you can try and see if you can enable "debug mode"on your shell:

bash -x -c rake sidekiq:start

for
example, will ​show you what commands are run, each command is executed and printed, with a + before it (one plus character for each level of the sub shells)

--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages