hexo-deployer-git
hexo-deployer-git copied to clipboard
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 [email protected]
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
[email protected]
Cheers
@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:
-
try to ping github with
ssh -T [email protected], to see if you can really connect with it. -
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}
Hi @loatheb does this mean the ping worked???
> ssh -T [email protected]
Permission denied (publickey).
@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.

@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 "[email protected]"
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 [email protected]
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"
@rashid-softordi thanks above solution works like a charm
How to make this work if my ssh key have a password?
@loatheb your solution works fine with me
BTW: if you have configured your ssh key with a password, and you are on windows, you have to run the command from the GIT Bash prompt.
update to the lastest git version
@Zhang21 your solution works fine with me
@Zhang21 Thanks a lot.
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
I could solve the same problem, I do appreciate your guide, @rashid-softordi , @loatheb ! Also @LaughingBubba , thanks to you, I could solve my problem. Without your question, I couldn't get the right answer!
@frontalnh This is useful.
deploy:
type: git
repo: [email protected]:agrass-GitHub/xxxx.git
branch: master
@frontalnh it's worked for me , thanks!
@Zhang21 thanks a lot. If someone else met this problem, plz check git version, I replace version 2.11.xx with 2.20.1, It's done!
@frontalnh thank u
This helped
Try adding this into your git config
[credential] helper = wincred or via console
git config --global credential.helper wincred
For me , I met a network issue ,so I use socks5
Unexpectedly, after executing git init under the local project directory, my problem has been solved. I hope it will also be helpful to you.