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

我已经使用github和capistrano将我的Rails 4应用程序部署到Rackspace几周了。 一切正常,直到我最终使我的存储库私有化。 现在,我在运行’cap deploy’后收到以下错误:

“致命:无法读取’ https://username@github.com ‘的密码:没有这样的设备或地址”

下面是我的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存储库名称前加上和没有用户名的情况下尝试过它。 如果它在那里,我从上面收到密码错误,但如果它不存在,我收到以下错误:

“致命:无法读取’ https://github.com ‘的用户名:没有这样的设备或地址”

知道问题是什么吗? 我假设它与我改变私有存储库有关。 我已经阅读了一些关于使用ssh的内容,但也读过没有。

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

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

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

在那之后,我能跑了

  cap deploy 

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

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

所以对于落在这里的其他人来说,这是一个非铁路的答案 :缺少的设备实际上是一个控制台。

  1. 您已尝试以非交互方式进行身份validation(即使用SSH密钥)。 这失败了。
  2. 作为后备,git尝试提示用户输入用户名,但这不起作用,因为交互式控制台不可用。

修复#1,因为您可能不希望在部署期间以交互方式进行身份validation。 就我而言,这是一个github oauth问题。

fatal: could not read Username for 'https://github.com': No such device or address"

首先检查github username您的scm user是否与您的代码中的服务器user相同?

你的代码

  set :scm_user, "user" set :user, "user" 

它应该是

  set :user, "deployer" # The server's user for deploys set :scm_user, "ram" # The github username 

还设置了密码

  set :scm_passphrase, "p@ssw0rd" # The deploy user's password 

现在知识库案例..据我认为你的存储库设置应该是

 set :repository, "git@github.com:username/repo.git" # Your clone URL 

  set :ssh_options, { :forward_agent => true }