致命:无法读取“https://github.com"的用户名:没有这样的设备或地址 [英] Fatal: could not read Username for 'https://github.com': No such device or address

查看:38
本文介绍了致命:无法读取“https://github.com"的用户名:没有这样的设备或地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几个星期以来,我一直在使用 github 和 capistrano 将我的 Rails 4 应用程序部署到 Rackspace.一切正常,直到我最终将我的存储库设为私有.现在,我在运行cap deploy"后收到以下错误:

I have been deploying my Rails 4 application to Rackspace using github and capistrano for a few weeks now. Everything worked fine until I finally made my repository private. Now, I am receiving the following error after running 'cap deploy':

"fatal: 无法读取 'https://username@github.com 的密码:没有这样的设备或地址"

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

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

Below is the code from my deploy.rb file

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 存储库名称前添加和不添加用户名.如果在那里,我会收到上面的密码错误,但如果不存在,我会收到以下错误:

I have tried it with and without the username prepended to the github repository name. If it is there, I receive the password error from above, but if it is not there, I receive the following error:

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

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

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

Any idea what the issue is? I'm assuming it has something to do with me changing to a private repository. I have read some things about using ssh but have also read not to.

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

Any suggestions or help would be much appreciated!

推荐答案

所以,我想通了.为了使用 Github 上的私有 repo 来使用 https 进行部署,您需要使用 Github 的 OAuth API.在您的 github 帐户上的编辑配置文件下,单击应用程序,然后生成 OAuth 令牌.然后,将您的令牌添加到您的回购网址中,如下所示:

So, I figured it out. In order to use a private repo on Github to deploy using https, you need to use Github's OAuth API. Under Edit Profile on your github account, click applications and then generate an OAuth Token. Then, prepend your token to your repo url like so:

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

在那之后,我能够运行

 cap deploy

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

and deploy my application to my remote server.

这篇关于致命:无法读取“https://github.com"的用户名:没有这样的设备或地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆