14
votes

Running cap deploy returns the error

ERROR: Repository not found.
fatal: The remote end hung up unexpectedly

failed: "env PATH=$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH sh -c 'if [ -d .../shared/cached-copy ]; then cd .../shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard e54354271256196e54354271256196 && git clean -q -d -x -f; else git clone -q -b new_front git@github.com:myapp.git .../shared/cached-copy && cd /shared/cached-copy && git checkout -q -b deploy ced405a4d2b184ccadf844185e54354271256196; fi'" on 192.111.111.111

but when i ssh to the server and run that exact command it works.

I've tried deleting the cached-copy and commenting set :deploy_via, "remote_cache" as mentioned in Cap deploy - ERROR: Repository not found but nothing works.

thanks

EDIT:

Similar issue: https://gist.github.com/ParkinT/2432735

2
Just upvoted because removing the remote cache fixed my issue thanks commenting set :deploy_via, "remote_cache"Jon

2 Answers

20
votes

I had to run:

ssh-add

to add my identity to the authentication agent.

10
votes

Turns out the problem was with ssh agent forwarding.

https://help.github.com/articles/using-ssh-agent-forwarding

Capistrano was setup

ssh_options[:forward_agent] = true

Locally I had two ssh keys, and somehow the one used locally was not the same one being used via the forward_agent. If you have a key on the server you can set

ssh_options[:forward_agent] = false

Otherwise, clear your keys and add just the one you need (on mac, ssh-add -D and ssh-add path/to/key).