Repository: capistrano/capistrano

Issue #734: Unable to use '~' in the :tmp dir variable
Created: 2013-10-25T14:59:10Z
When setting the :tmp_dir, '~/tmp' I get the following error:
cap staging git:wrapper --trace
** Invoke staging (first_time)
** Execute staging
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke git:wrapper (first_time)
** Execute git:wrapper
cap aborted!
scp: ~/tmp/git-ssh.sh: No such file or directory
/Users/bruno/.rvm/gems/ruby-2.0.0-p247/gems/net-scp-1.1.2/lib/net/scp.rb:392:in `await_response_state'
/Users/bruno/.rvm/gems/ruby-2.0.0-p247/gems/net-scp-1.1.2/lib/net/scp.rb:363:in `block (3 levels) in start_command'
/Users/bruno/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:311:in `call'
/Users/bruno/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:311:in `process'
/Users/bruno/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:222:in `block in preprocess'
/Users/bruno/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:222:in `each'
/Users/bruno/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:222:in `preprocess'
/Users/bruno/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:205:in `process'
/Users/bruno/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/Users/bruno/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/bruno/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/bruno/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:269:in `wait'
/Users/bruno/.rvm/gems/ruby-2.0.0-p247/gems/net-scp-1.1.2/lib/net/scp.rb:279:in `upload!'
/Users/bruno/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:68:in `upload!'
/Users/bruno/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.0.0/lib/capistrano/tasks/git.rake:11:in `block (3 levels) in <top (required)>'
/Users/bruno/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:42:in `instance_exec'
/Users/bruno/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:42:in `run'
/Users/bruno/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => git:wrapper

However using set :tmp_dir, '/home/dummy/tmp/' it works.

Duplicate issue #1472: Using  ~/tmp as tmp_dir fail
Created: 2015-07-28T09:34:07Z
I do not have one single user for the deployment but several. I have to use another tmp_dir for each user otherwise you end up with access conflict like in #687 (comment).
So I tried to use
set :ssh_user_name, ask('Enter your SSH user name:', 'deploy')
set :tmp_dir, "~/tmp"

But this fail
➜  website.com.dev git:(staging) ✗ bundle exec cap staging deploy --trace
** Invoke staging (first_time)
** Execute staging
** Invoke load:defaults (first_time)
** Execute load:defaults
Please enter Enter your SSH user name: (deploy): myuser
** Invoke deploy (first_time)
** Execute deploy
** Invoke deploy:starting (first_time)
** Execute deploy:starting
** Invoke deploy:check (first_time)
** Execute deploy:check
** Invoke git:check (first_time)
** Invoke git:wrapper (first_time)
** Execute git:wrapper
INFO [de4aff8e] Running /usr/bin/env mkdir -p ~/tmp/myproject/ as myuser@10.128.38.11
DEBUG [de4aff8e] Command: /usr/bin/env mkdir -p ~/tmp/myproject/
INFO [de4aff8e] Finished in 0.350 seconds with exit status 0 (successful).
DEBUG Uploading ~/tmp/myproject/git-ssh.sh 0.0%
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as myuser@10.128.38.11: scp: ~/tmp/myproject/git-ssh.sh: No such file or directory
/usr/local/lib/ruby/gems/2.2.0/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:16:in `rescue in block (2 levels) in execute'
/usr/local/lib/ruby/gems/2.2.0/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
scp: ~/tmp/myproject/git-ssh.sh: No such file or directory
/usr/local/lib/ruby/gems/2.2.0/gems/net-scp-1.2.1/lib/net/scp.rb:398:in `await_response_state'
/usr/local/lib/ruby/gems/2.2.0/gems/net-scp-1.2.1/lib/net/scp.rb:369:in `block (3 levels) in start_command'
/usr/local/lib/ruby/gems/2.2.0/gems/net-ssh-2.9.2/lib/net/ssh/connection/channel.rb:311:in `call'
/usr/local/lib/ruby/gems/2.2.0/gems/net-ssh-2.9.2/lib/net/ssh/connection/channel.rb:311:in `process'
/usr/local/lib/ruby/gems/2.2.0/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:223:in `block in preprocess'
/usr/local/lib/ruby/gems/2.2.0/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:223:in `each'
/usr/local/lib/ruby/gems/2.2.0/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:223:in `preprocess'
/usr/local/lib/ruby/gems/2.2.0/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:206:in `process'
/usr/local/lib/ruby/gems/2.2.0/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:170:in `block in loop'
/usr/local/lib/ruby/gems/2.2.0/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:170:in `loop'
/usr/local/lib/ruby/gems/2.2.0/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:170:in `loop'
/usr/local/lib/ruby/gems/2.2.0/gems/net-ssh-2.9.2/lib/net/ssh/connection/channel.rb:269:in `wait'
/usr/local/lib/ruby/gems/2.2.0/gems/net-scp-1.2.1/lib/net/scp.rb:284:in `upload!'
/usr/local/lib/ruby/gems/2.2.0/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:83:in `block in upload!'
/usr/local/lib/ruby/gems/2.2.0/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:194:in `with_ssh'
/usr/local/lib/ruby/gems/2.2.0/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:82:in `upload!'
/usr/local/lib/ruby/gems/2.2.0/gems/capistrano-3.4.0/lib/capistrano/tasks/git.rake:18:in `block (3 levels) in <top (required)>'
/usr/local/lib/ruby/gems/2.2.0/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/usr/local/lib/ruby/gems/2.2.0/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:54:in `run'
/usr/local/lib/ruby/gems/2.2.0/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
Tasks: TOP => git:check => git:wrapper
The deploy has failed with an error: Exception while executing as myuser@10.128.38.11: scp: ~/tmp/myproject/git-ssh.sh: No such file or directory
** Invoke deploy:failed (first_time)
** Execute deploy:failed

Closing comment (2015-07-28T09:38:52Z): I guess it's related to #734 but it doesn't give any solution so I will keep this one open.