Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fatal: destination path '.' already exists and is not an empty directory. #646

Closed
pedrost opened this issue Jul 18, 2019 · 1 comment
Closed

Comments

@pedrost
Copy link

pedrost commented Jul 18, 2019

I'm getting this error when I try to deploy to production..
I can easily clone the repository from the server and everything seems to works fine without mina, any suggestions to solve this issue?

Here's my deploy.rb

require 'mina/deploy'
require 'mina/git'
require 'mina/rvm'

set :repository, 'git@gitlab.com:jera-software/house-society-front.git'

set :identity_file, ENV['IDENTIFY_FILE']
set :environment,   ENV['ENV']

set :application_name, 'house_society'
set :user, fetch(:application_name)
set :node_version, 'v8.11.3'
set :nvm_path, "/etc/profile.d/nvm.sh"
set :base_path, "/var/www/#{fetch(:user)}"

if fetch(:environment) == 'staging'
  set :branch,    'develop'
  set :domain,    '3.84.202.209'
  set :deploy_to, "#{fetch(:base_path)}/staging/front"
elsif fetch(:environment) == 'production'
  set :branch,    'master'
  set :domain,    '3.84.202.209'
  set :deploy_to, "#{fetch(:base_path)}/production/front"
end

set :shared_dirs, fetch(:shared_dirs, []).push('log')

task :remote_environment do
  if !fetch(:environment)
    raise "You need to pass the identify file and environment, ex. mina deploy ENV=[production,staging] IDENTIFY_FILE=$HOME/ec2/key.pem"
  end
  command %[source #{fetch(:nvm_path)}]
end

desc "Deploys the current version to the server."
task :deploy do

  deploy do
    invoke :'git:clone'
    invoke :'deploy:link_shared_paths'
    
    command %[echo "ENV ---> #{fetch(:environment)}"]
    command %[echo "DEPLOY_TO ---> #{fetch(:deploy_to)}"]
    command %[echo "SHARED PATH ---> #{fetch(:shared_path)}"]

    command %[npm cache clean --force]
    command %[npm config set strict-ssl false]
    command %[npm config set registry="http://registry.npmjs.org/"]
    command %[npm set progress=false]
    command %[rm -rf node_modules/]
    command %[npm install]
    command %[npm run build:#{fetch(:environment)}]
    command %[cp -R dist/* .]

    invoke :'deploy:cleanup'

  end
end

Here's the error I'm getting

** Invoke deploy (first_time)
** Execute deploy
** Invoke remote_environment (first_time)
** Execute remote_environment
** Invoke git:clone (first_time)
** Execute git:clone
** Invoke deploy:link_shared_paths (first_time)
** Execute deploy:link_shared_paths
** Invoke deploy:cleanup (first_time)
** Execute deploy:cleanup
-----> Creating a temporary build path
       => nvm is already installed in /var/www/house_society/.nvm, trying to update using git
=>
       => Source string already in /var/www/house_society/.bashrc
       => Close and reopen your terminal to start using nvm
-----> Fetching new git commits
-----> Using git branch 'master'
       fatal: destination path '.' already exists and is not an empty directory.
 !     ERROR: Deploy failed.
-----> Cleaning up build
       Unlinking current
       OK
       Connection to 3.84.202.209 closed.

 !     Run Error
@pedrost
Copy link
Author

pedrost commented Jul 18, 2019

Solved, my issue was that mina task git:clone was clonning in the wrong path repository
My .bashrc file was forcing the user to enter the .nvm directory to install nvm and didnt come back to the original deploy_to path.
I changed my .bashrc file inside the application user in my server and it worked.

@pedrost pedrost closed this as completed Jul 18, 2019
@pedrost pedrost reopened this Jul 18, 2019
@pedrost pedrost closed this as completed Jul 18, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant