git repository not recognized during rails deploy with capistrano

Go To StackoverFlow.com

6

I'm trying to figure out why I'm getting an error from my remote git repository when I try to deploy my rails app. It's telling me that it's not a git repository, yet I can push and pull from it without issue. However I recently had issues with git not being found by bash, but it was simply a path variable issue that cropped up when I installed macports (I think). It's now fixed. Thanks in advance for any help you might be able to provide! The error output is below:

my-MacBook-Pro:project myUser$ cap deploy:update
  * executing `deploy:update'
 ** transaction: start
  * executing `deploy:update_code'
    updating the cached checkout on all servers
    executing locally: "git ls-remote git@server.example.ca/usr/local/git_root/project.git master"
fatal: 'git@server.example.ca/usr/local/git_root/project.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
*** [deploy:update_code] rolling back
  * executing "rm -rf /usr/local/www/sites/project.example.ca/releases/20120403193900; true"
    servers: ["project.example.ca"]
    [project.example.ca] executing command
    [project.example.ca] rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell 'ruby-1.9.2-p290@project' -c 'rm -rf /usr/local/www/sites/project.example.ca/releases/20120403193900; true'
    command finished in 639ms
Command git ls-remote git@server.example.ca/usr/local/git_root/project.git master returned status code pid 1815 exit 128
2012-04-03 20:02
by J K


1

Turns out the problem was that the repository address WAS malformed as the user above suggested. However, the problem was resolved by adding an 'ssh:' prefix to the repository address. Thanks for the suggestions!

2012-04-04 19:13
by J K


5

Looks like you've got a malformed Git URL:

git ls-remote git@server.example.ca/usr/local/git_root/project.git master

Should be:

git ls-remote git@server.example.ca:/usr/local/git_root/project.git master

They follow SCP protocol (see the git-clone manpage for more).

2012-04-03 20:06
by Nic


3

Your key must be available to ssh-agent

I had same problem. Solved with "ssh-add yourkey" , where yourkey is the path do id_rsa, and you can check with: ssh-add -L, if ok will return your public key

2012-10-26 13:37
by Juarez Lustosa


-2

Could you try deleting the local repository and re-cloning it?

2012-04-03 20:06
by Mizuho
This isn't necessary - Nic 2012-04-03 20:16
This should not be necessary - Francisco Quintero 2016-12-14 04:24