關於使用githup hexo csdn中的Markdown編輯器發佈搭建自己的githup博客*
先下載git
下載安裝很多方法, 這裏用了迅雷下載,
個人覺得挺快的https://github.com/git-for-windows/git/releases/download/v2.19.0.windows.1/Git-2.19.0-64-bit.exe
安裝好git 然後開始安裝hexo
找一個盤符安裝 創建一個hexo文件下 打開終端安裝 記住路徑待會有用
npm install hexo-cli -g //全局的
hexo init hexo
cd hexo
npm install
hexo server//端口是4000 你在編輯器終端如果打開了,在git bash 就會報錯,必須關掉一個
接下來點擊終端的http://localhost:4000/
登錄githup 建一個倉庫 epository name 要寫成這樣的格式username.github.io,例如我用戶名創建時wz.github.io
點擊create repository就創建好了。
接下你可以測試一下,點擊create new file.,輸入index.html,輸入
Hello Github
.然後提交。複製你的鏈接用戶名.github.io,然後轉到該頁面上去。如果顯示出Hello Github,證明你創建的已經成功。如果顯示404(所請求的頁面不存在或已被刪除!),不要着急,問題出在Github服務器上,估計是翻牆什麼的緣故吧,會卡一些,你創建的文件不會立即上傳過去,要做的就是好好睡一覺明天在搭(上面的解決方法是當時搭建的時候自己感覺的,其實不是的 應該是訪問時再加上https://,如(https://bealright.github.io/),這樣才能訪問,上面的也就不刪除了,也是當時的感受
git和你的githup連接,有問題可以看看別的帖子
$ git config --global user.name “xxx” //你的githup賬號名
$ git config --global user.email “[email protected]” //你用哪個郵箱註冊的, 等會還要輸入密碼的
$ ssh-keygen -t rsa // 創建密鑰 打開c盤的用戶下的.ssh文件下id_rsa.pub看見一串密鑰,複製密鑰
在githup下的setting中
選擇SSH and GPG keys
粘貼密鑰
ssh -T [email protected]測試是否成功
ssh-keygen -t rsa -C “[email protected]” //註冊githup的郵箱
cat ~/.ssh/id_rsa.pub
remote origin already exists.解決方法 git remote rm origin
git remote add origin https://github.com/wzwuzhe/wzwuzhe.github.io.git
1.先查看遠程倉庫地址:git remote -v,如果地址是https,那肯定需要密碼啊!
2.如果是https,那就改爲ssh: git remote set-url origin [email protected]:xxxxxxx/xxx.git
3.改完提交就不要密碼了;
ssh: git remote set-url origin [email protected]:xxxxxxx/xxx.git
Username for ‘https://github.com’: 輸入的是github上的郵箱賬號, 而不是github中設置的username, 這是個巨坑!!!
Password for ‘https://你的github郵箱@github.com’: 輸入github的登錄密碼,點擊enter鍵即可.
git add .
git commit -am “”
git commit origin hexo
將hexo和GitHub關聯起來
之後就可以看見我們的博客啦