Mika
Mika

Reputation: 1479

Capistrano 3.14 cannot get connection to my git during deployment

I have done this many times, but now something in the git connection is not working. I create a user into my server and generate a public key for it, added the public key to my git so that Capistrano should be able to pull the code.

But when I try to deploy, I get:

00:01 git:check
      01 git ls-remote [email protected]:mustalahtisolutions/projects/heater_controller/repositories/git/heater_controller HEAD
      01 fatal: Could not read from remote repository.
      01
      01 Please make sure you have the correct access rights
      01 and the repository exists.

When I SSH to the server and run git ls-remote [email protected]:mustalahtisolutions/projects/heater_controller/repositories/git/heater_controller HEAD it works.

WTF Capistrano, what is this? I have read about forward agent solution, but my other projects are deploying fine without it, I should not need it.

How can I make Capistrano to run the commands as the user on the server?

Upvotes: 0

Views: 212

Answers (1)

Mika
Mika

Reputation: 1479

Turned out that Capistrano uses forward agent by default, which in my case authenticated against Git with an incorrect identity file. I disabled the forward agent with set :ssh_options, { :forward_agent => false } and now my deploys are working.

Upvotes: 1

Related Questions