Mina Deploy使用错误的用户

时间:2017-11-24 23:59:43

标签: ruby deployment

我对gem' mina'有一些问题。如果我set :user, 'username',他会尝试通过Username@xxx....连接到服务器,如果用户不存在则无法正常工作。我的电脑名为Username。因此mina setupmina deploy无效。 有人知道解决方案吗?。

由于

祝你好运

Matze

编辑:

的Gemfile:

gem 'mina'

之后我运行bundle installmina init

deploy.rb:

    require 'mina/rails'
    require 'mina/git'
    # require 'mina/rbenv'  # for rbenv support. (https://rbenv.org)
    require 'mina/rvm'    # for rvm support. (https://rvm.io)

    # Basic settings:
    #   domain       - The hostname to SSH to.
    #   deploy_to    - Path to deploy into.
    #   repository   - Git repo to clone from. (needed by mina/git)
    #   branch       - Branch name to deploy. (needed by mina/git)
    set :user, "user"
    set :application_name, 'appname'
    set :domain, 'xx.xxx.xxx.xxx'
    set :deploy_to, '/var/www/user/appname'
    set :repository, 'user@xx.xxx.xxx.xxx:/home/user/git/appname.git'
    set :branch, 'master'
    # Optional settings:
    #   set :user, 'user'            # Username in the server to SSH to.
    #   set :port, '30000'           # SSH port number.
    #   set :forward_agent, true     # SSH forward_agent.

    # Shared dirs and files will be symlinked into the app-folder by the 'deploy:link_shared_paths' step.
    # Some plugins already add folders to shared_dirs like `mina/rails` add `public/assets`, `vendor/bundle` and many more
    # run `mina -d` to see all folders and files already included in `shared_dirs` and `shared_files`
    # set :shared_dirs, fetch(:shared_dirs, []).push('public/assets')
    set :shared_files, fetch(:shared_files, []).push('config/database.yml', 'config/secrets.yml')

    # This task is the environment that is loaded for all remote run commands, such as
    # `mina deploy` or `mina rake`.
    task :remote_environment do
      # If you're using rbenv, use this to load the rbenv environment.
      # Be sure to commit your .ruby-version or .rbenv-version to your repository.
      # invoke :'rbenv:load'

      # For those using RVM, use this to load an RVM version@gemset.
      # invoke :'rvm:use', 'ruby-1.9.3-p125@default'
    end

    # Put any custom commands you need to run at setup
    # All paths in `shared_dirs` and `shared_paths` will be created on their own.
    task :setup do
      # command %{rbenv install 2.3.0 --skip-existing}
    end

    desc "Deploys the current version to the server."
    task :deploy do
      # uncomment this line to make sure you pushed your local branch to the remote origin
      # invoke :'git:ensure_pushed'
      deploy do
        # Put things that will set up an empty directory into a fully set-up
        # instance of your project.
        invoke :'git:clone'
        invoke :'deploy:link_shared_paths'
        invoke :'bundle:install'
        invoke :'rails:db_migrate'
        invoke :'rails:assets_precompile'
        invoke :'deploy:cleanup'

        on :launch do
          in_path(fetch(:current_path)) do
            command %{mkdir -p tmp/}
            command %{touch tmp/restart.txt}
          end
        end
      end

      # you can use `run :local` to run tasks on local machine before of after the deploy scripts
      # run(:local){ say 'done' }
    end

    # For help in making your deploy script, see the Mina documentation:
    #
    #  - https://github.com/mina-deploy/mina/tree/master/docs
    set :execution_mode, :exec if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/

当我现在跑mina setup时,他打印出来:

    $ mina setup
    User@xx.xxx.xxx.xxx's password:

SSH验证密钥工作正常并且git工作正常他只是在ip之前放置User而不是user,因为用户只是存在小写字母而无法正常工作。但我的工作机器名为User

0 个答案:

没有答案