I am just starting to learn capistrano, below is my configuration that i have setup and trying to use with circleci
deploy.rb
# config valid for current version and patch releases of Capistrano
lock "~> 3.17.3"
# Application name
set :application, ENV["CIRCLE_PROJECT_REPONAME"]
# Git repository URL
set :repo_url, "git@github.com:organization-name/" + ENV["CIRCLE_PROJECT_REPONAME"] + ".git"
# Git branch you want to pull from. Default branch is :main
set :branch, "main"
# Directory where you want to deploy
set :deploy_to, "/var/www/html"
# Default value for keep_releases is 5
set :keep_releases, 3
production.rb
# Server options
server ENV["DROPLET_IP"],
user: ENV["DROPLET_USER"],
roles: %w{app},
ssh_options: {
keys: %w(/root/.ssh/id_rsa),
forward_agent: true,
auth_methods: %w(publickey)
}
# Git branch you want to pull from. Overrides Default branch
#set :branch, 'main'
set :branch, 'feature/capistrano'
When pipeline runs, i get the error fatal: 'HEAD' does not appear to be a git repository
& Please make sure you have the correct access rights
when i try to clone on my server with git clone git@github.com:organization-name/repo-name.git
repository is cloned without any warnings or errors.
i have setup server's ssh in my personal git account. Repo exists on my own organisation account.
I have also tried to set repo_url
in deploy.rb
to
set :repo_url, "https://username:personal_access_token@github.com/organization-name/repo-name.git"
and ssh_options
in production.rb
to
ssh_options: {
#keys: %w(/root/.ssh/id_rsa),
forward_agent: false,
auth_methods: %w(password)
}
But if i do that i get NoMethodError: undefined method 'chomp' for nil:NilClass
I don't fully understand what i might be doing wrong or missing. Any help is apritiated.
Regards