hexo-deployer-git: fatal: could not read Username for 'https://github.com': Invalid argument

Hi I’m getting the above when I try to

hexo deploy

I’m not the only one to have this problem if you look at the latest comments in the Hexo trouble shooting guide

Indeed I am running on win10, however I suspect it’s more likely there’s a missing environment variable than not using the git cli.

Here’s my repo

hexo deploy console log:

C:\Users\joseph\projects\LaughingBubba.github.io (master)
> hexo deploy
INFO  Deploying: git
INFO  Setting up Git deployment...
====> user name LaughingBubba email laugingbubba@outlook.com
Initialized empty Git repository in C:/Users/joseph/projects/LaughingBubba.github.io/.deploy_git/.git/
[master (root-commit) 80def97] First commit
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 placeholder
INFO  Clearing .deploy_git folder...
INFO  Copying files from public folder...
INFO  Copying files from extend dirs..
...
blah ... multiple LF being replaced by CRLF warnings ... blah
...
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': Invalid argument
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Error: bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': Invalid argument

    at ChildProcess.<anonymous> (C:\Users\joseph\projects\LaughingBubba.github.io\node_modules\hexo-util\lib\spawn.js:37:17)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at ChildProcess.cp.emit (C:\Users\joseph\projects\LaughingBubba.github.io\node_modules\cross-spawn\lib\enoent.js:40:29)
    at maybeClose (internal/child_process.js:877:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
FATAL bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': Invalid argument

Error: bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': Invalid argument

    at ChildProcess.<anonymous> (C:\Users\joseph\projects\LaughingBubba.github.io\node_modules\hexo-util\lib\spawn.js:37:17)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at ChildProcess.cp.emit (C:\Users\joseph\projects\LaughingBubba.github.io\node_modules\cross-spawn\lib\enoent.js:40:29)
    at maybeClose (internal/child_process.js:877:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

NOTE: I deleted the .deploy_git folder and slipped in a console.log() in the local deployer set up function to make sure the user name was being parsed and I did make a typo.

I also made sure my global git user settings were right

C:\Users\joseph\projects\LaughingBubba.github.io (master)
> git config --global user.name
LaughingBubba

C:\Users\joseph\projects\LaughingBubba.github.io (master)
> git config --global user.email
laughingbubba@outlook.com

Cheers

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 20 (2 by maintainers)

Most upvoted comments

@LaughingBubba

@tsupol # Issue is SOLVED! error: failed to execute prompt script (exit code 1) fatal: could not read Username for ‘https://github.com’: Invalid argument

1- Create a ssh key using Git Bash using following command

ssh-keygen -t rsa -b 4096 -C "your-github@email.com"

After running this command just install the by default options and enter the password balnk when it prompts.

2- Then run the following commands to locate the public/private key generated from step1

cd .ssh

cd ~/.ssh

3- Then run the following command to view your public:

cat id_rsa.pub

4- Copy your public key and go to your GitHub account -> settings -> create a SSH and GPG keys then click new ssh key and past your public key in the in key text field.

5- Verify your public key using Git Bash by running the following command:

ssh -vT git@github.com

You will get output like this

debug1: channel 0: free: client-session, nchannels 1 Transferred: sent 3848, received 2040 bytes, in 0.2 seconds Bytes per second: sent 16032.4, received 8499.5 debug1: Exit status 1

Then you no longer got “could not read Username for ‘https://github.com’: Invalid argument”

update to the lastest git version

I solved it by modifying ‘_config.yml’ configuration

I tried all above but failed. then I found the configuration that hinders git to deploy by ssh

change remote origin from HTTP URL to ssh URL as noted above and additionally, fix the _config.yml file deploy information

deploy:
  type: git
  repo: {your ssh git repo}

it worked to me

@LaughingBubba I’m not sure. But I don’t think it’s the error with hexp-deployer-git, I think it’s some reason with the git or repo. Try to do that:

  1. try to ping github with ssh -T git@github.com, to see if you can really connect with it.

  2. try to change your repo remote into ssh

git remote -v

if the remote is https, change to use ssh.

git remote remove origin
git remote add origin ${your-ssh-repo-url}

This helped

Try adding this into your git config

[credential] helper = wincred or via console

git config --global credential.helper wincred

@LaughingBubba No. That means you can’t use git command to connect with github. Check your ssh public key to make the result like this. image