Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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: could not read Password for 'https://[email protected]': No such device or address"

Below is the code from my deploy.rb file

set :application, "appname"
set :repository,  "https://[email protected]/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

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:

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

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!

like image 912
user2147143 Avatar asked Sep 19 '13 05:09

user2147143


People also ask

How do I fix a fatal error on GitHub?

The above error indicates that there is one more commit that was pushed to the same branch, but you don't have that commit on your local machine. To fix this, you can easily run a git pull origin <your-branch> , solve the conflicts if any, and then run git push origin <your-branch> to push your changes as well.

How do you fix fatal could not read from remote repository please make sure you have the correct access rights and the repository exists?

The Git “fatal: Could not read from remote repository” error occurs when there is an issue authenticating with a Git repository. This is common if you have incorrectly set up SSH authentication. To solve this error, make sure your SSH key is in your keychain and you connecting to a repository using the correct URL.

What is GitHub HTTPS username?

Your user name is what immediately follows the https://github.com/ .


1 Answers

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"

After that, I was able to run

 cap deploy

and deploy my application to my remote server.

like image 80
user2147143 Avatar answered Oct 11 '22 01:10

user2147143