標籤:

有關使用 Hexo 和 GitHub 搭建博客,出現 hexo -d 報錯如何解決?

新手小白,能夠在本地打開,但是部署不到github上去 = = hexo d的時候報錯,向大家求助一下本問題。

$ hexo d

INFO Deploying: git

INFO Clearing .deploy folder...

INFO Copying files from public folder...

warning: LF will be replaced by CRLF in 2015/12/05/hello-world/index.html.

The file will have its original line endings in your working directory.

……

warning: LF will be replaced by CRLF in index.html.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in js/script.js.

The file will have its original line endings in your working directory.

On branch master

nothing to commit, working directory clean

bash: /dev/tty: No such device or address

error: failed to execute prompt script (exit code 1)

fatal: could not read Username for "GitHub · Where software is built": No error

FATAL Something"s wrong. Maybe you can find the solution here: Troubleshooting

Error: bash: /dev/tty: No such device or address

error: failed to execute prompt script (exit code 1)

fatal: could not read Username for "GitHub · Where software is built": No error

at ChildProcess.& (E:SwuComputerHTML5hexo
ode_moduleshexo-deployer-git
ode_moduleshexo-utillibspawn.js:42:17)

at emitTwo (events.js:87:13)

at ChildProcess.emit (events.js:172:7)

at maybeClose (internal/child_process.js:818:16)

at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)

我創建username的指令是

git config --global user.name "ddariusliu"

username是指的github的用戶名吧


這個問題是這樣解決的

第一刪除你hexo 下面的.deploy_git文件夾

第二 運行

第三 重新 hexo clean

hexo g

hexo d

第四 打開自己的網址,進行驗證是否成功


我也遇到同樣問題

$ hexo d

INFO Deploying: git

INFO Clearing .deploy_git folder...

INFO Copying files from public folder...

warning: LF will be replaced by CRLF in 2016/07/12/hello-world/index.html.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in archives/2016/07/index.html.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in archives/2016/index.html.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in archives/index.html.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in css/style.css.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in fancybox/helpers/jquery.fancybox-buttons.css.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in fancybox/helpers/jquery.fancybox-buttons.js.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in fancybox/helpers/jquery.fancybox-media.js.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in fancybox/helpers/jquery.fancybox-thumbs.css.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in fancybox/helpers/jquery.fancybox-thumbs.js.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in fancybox/jquery.fancybox.css.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in fancybox/jquery.fancybox.js.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in fancybox/jquery.fancybox.pack.js.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in index.html.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in js/script.js.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in 2016/07/12/hello-world/index.html.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in archives/2016/07/index.html.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in archives/2016/index.html.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in archives/index.html.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in index.html.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in 2016/07/12/hello-world/index.html.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in archives/2016/07/index.html.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in archives/2016/index.html.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in archives/index.html.

The file will have its original line endings in your working directory.

[master faade2d] Site updated: 2016-07-12 16:50:48

5 files changed, 22 insertions(+), 22 deletions(-)

warning: LF will be replaced by CRLF in index.html.

The file will have its original line endings in your working directory.

bash: /dev/tty: No such device or address

error: failed to execute prompt script (exit code 1)

fatal: could not read Username for "How people build software · GitHub": Invalid argument

FATAL Something"s wrong. Maybe you can find the solution here: Troubleshooting

Error: bash: /dev/tty: No such device or address

error: failed to execute prompt script (exit code 1)

fatal: could not read Username for "How people build software · GitHub": Invalid argument

at ChildProcess.& (F:andybroker
ode_moduleshexo-utillibspawn.js:37:17)

at emitTwo (events.js:106:13)

at ChildProcess.emit (events.js:191:7)

at ChildProcess.cp.emit (F:andybroker
ode_modulescross-spawnlibenoent.js:40:29)

at maybeClose (internal/child_process.js:852:16)

at Process.ChildProcess._handle.onexit (internal/child_process.js:215: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 "How people build software · GitHub": 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 "How people build software · GitHub": Invalid argument

at ChildProcess.& (F:andybroker
ode_moduleshexo-utillibspawn.js:37:17)

at emitTwo (events.js:106:13)

at ChildProcess.emit (events.js:191:7)

at ChildProcess.cp.emit (F:andybroker
ode_modulescross-spawnlibenoent.js:40:29)

at maybeClose (internal/child_process.js:852:16)

at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)


遇到了同樣的問題

我覺得原因可能是用了windows 的cmd來操作

我換成git bash 後,就沒有問題了

在之前報錯的地方會彈出對話框,讓你輸入github的賬號和密碼

正如所有其他你要git push的時候一樣


非要把知乎弄成百度一樣,沒有一個真正的解決答案


貼上一篇我之前搭建博客時,參考的教程

引用自:Xuanwo"s Blog// 史上最詳細的Hexo博客搭建圖文教程

-----------------------------------

配置Deployment首先,你需要為自己配置身份信息,打開命令行,然後輸入:

  • git config --global user.name "yourname"

  • git config --global user.email "youremail"

同樣在_config.yml文件中,找到Deployment,然後按照如下修改:

deploy:

type: git

repo: git@github.com:yourname/yourname.github.io.git

branch: master

如果使用git方式進行部署,執行npm install hexo-deployer-git --save來安裝所需的插件

然後在當前目錄打開命令行,輸入:

hexo d

隨後按照提示,分別輸入自己的Github賬號用戶名和密碼,開始上傳。

-------------------------------

你看看會不會是這邊的配置出現了問題。


今天遇到這個問題 按照以下方式解決的 其他網友有相同問題的可以試試:

_config.yml文件中,找到Deployment:

deploy:

type: git

repo: https://github.com/yourname/yourname.github.io.git

branch: master

其中 repo的地址修改為

git@github.com:yourname/yourname.github.io.git


剛才遇到這個問題,

我的情況是這樣,按照網上的教程,repo裡面寫的

就可以了


遇到了同樣的問題,以管理員身份運行命令行後第一次沒有問題,第二次就不行了, 換成git bash也不行,倉庫修改為 git@github.com:yourname/yourname.github.io.git 後可行


遇到了同樣的問題


注意是https,不是http


推薦閱讀:

有哪些好看的 Hexo 主題?

TAG:博客 | GitHub | Hexo |