Ruby on rails 致命:无法读取';https://github.com': 没有这样的设备或地址

Ruby on rails 致命:无法读取';https://github.com': 没有这样的设备或地址,ruby-on-rails,deployment,github,capistrano,Ruby On Rails,Deployment,Github,Capistrano,几周来,我一直在使用github和capistrano将Rails 4应用程序部署到Rackspace。在我最终将存储库私有化之前,一切都很顺利。现在,我在运行“cap部署”后收到以下错误: 致命:无法读取“”的密码:没有此类设备或地址 下面是我的deploy.rb文件中的代码 set :application, "appname" set :repository, "https://git_username@github.com/git_username/appname.git" set :

几周来,我一直在使用github和capistrano将Rails 4应用程序部署到Rackspace。在我最终将存储库私有化之前,一切都很顺利。现在,我在运行“cap部署”后收到以下错误:

致命:无法读取“”的密码:没有此类设备或地址

下面是我的deploy.rb文件中的代码

set :application, "appname"
set :repository,  "https://git_username@github.com/git_username/appname.git"
set :scm, :git
set :scm_username, "git_username"
set :scm_passphrase, "git_password"
set :scm_command, "git"
set :keep_releases, 5
set :branch, "master"
set :rails_env, "production"

set :deploy_to, "/var/www/doLocal"

set :user, "deployer"
set :password, "deployer_password"
set :use_sudo, false

ssh_options[:forward_agent] = true

server "/path/to/server", :app, :web, :db, :primary => true

after "deploy:restart", "deploy:cleanup"


namespace :deploy do
  task :start do ; end
  task :stop do ; end
  task :restart, :roles => :app, :except => { :no_release => true } do
     run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
  end
end
我尝试过在github存储库名称前面加上或不加上用户名。如果有,我会收到上面的密码错误,但如果没有,我会收到以下错误:

致命:无法读取“”的用户名:没有此类设备或地址

知道问题是什么吗?我假设这与我改为私有存储库有关。我读过一些关于使用ssh的文章,但也读过不使用ssh的文章


任何建议或帮助都将不胜感激

致命:无法读取的用户名'https://github.com“:没有此类设备或地址”

首先检查
github
用户名
您的
scm用户
是否与代码中的服务器
用户
相同

你的代码

 set :scm_user, "user"
 set :user, "user"
应该是

 set :user, "deployer"  # The server's user for deploys
 set :scm_user, "ram"  # The   github username
set :repository, "git@github.com:username/repo.git"  # Your clone URL
还要设置密码短语

  set :scm_passphrase, "p@ssw0rd"  # The deploy user's password
现在存储库案例..根据我认为您的存储库设置应该是

 set :user, "deployer"  # The server's user for deploys
 set :scm_user, "ram"  # The   github username
set :repository, "git@github.com:username/repo.git"  # Your clone URL


所以,我找到了答案。为了在Github上使用私有repo来使用https进行部署,您需要使用Github的OAuth API。在Github帐户的“编辑配置文件”下,单击“应用程序”,然后生成OAuth令牌。然后,将令牌预先添加到您的repo url,如下所示:

 set :repository,  "https://<OAuthToken>@github.com/username/application.git"

并将我的应用程序部署到我的远程服务器。

错误消息是一个通用的git错误,尽管问题本身是特定于Ruby的

因此,对于降落在这里的其他人来说,这里有一个非rails的答案:丢失的设备实际上是一个控制台

  • 您已尝试以非交互方式(即使用SSH密钥)进行身份验证。此操作失败
  • 作为备用方案,git尝试提示用户输入用户名,但这不起作用,因为交互式控制台不可用

  • 修复#1,因为您可能不希望在部署期间以交互方式进行身份验证。在我的情况下,这是github oauth问题。

    您能否尝试在https url中指定用户:
    https://user@github.com/username/repo.git
    我试过这么做,但是得到了相同的错误,只是密码无法读取谢谢你的回复ponse!我尝试了所有这些,但都不起作用。我没有正确设置用户名,正如您在上面解释的,但是更改存储库导致capistrano无法找到存储库,它说“权限被拒绝(公钥)”.fatal:无法从远程存储库读取。'将OAuthToken放在服务器上的文件中是一种安全的方法吗?谢谢!