Capistrano – sudo: must be setuid root sudo: must be setuid root sudo: must be setuid root

I’m in the process of trying to automate the deployment of a rails application. For this I’m using a framework called Capistrano. However, when I tried to deploy onto the remote server I was given the following error:
pretty:railsapp Ben$ cap deploy:setup
* executing `deploy:setup'
* executing "sudo -p 'sudo password: ' mkdir "
servers: ["attendoo.com"]
[attendoo.com] executing command
** [out :: attendoo.com] sudo: must be setuid root
command finished

By default, Capistrano uses sudo by default, as such in the deploy.rb file you need to set it to not use sudo

set :use_sudo, false

After this, when you deploy it will not attempt to issue the commands as sudo, instead just as the user you are logged in as.