gitee 搭建個人網站

gitee 搭建個人網站

查看是否已生成密鑰

ls ~/.ssh

沒有則需要生成密鑰

ssh-keygen -t rsa -C "[email protected]"

添加密鑰到ssh-agent(ssh-agent是控制用來保存公鑰身份驗證所使用的私鑰的程序,優點是不用重複輸入密碼和重複部署私鑰)

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa

Identity added: /home/wang/.ssh/id_rsa (/home/wang/.ssh/id_rsa)

添加公鑰到gitee上

這裏寫圖片描述

測試是否添加成功

ssh -T git@gitee.com

在gitee上創建項目
這裏寫圖片描述

獲取下載的地址,一般用的是https的,然後將項目下載到本地

git clone https://gitee.com/bottomheater/demo4js.git

在將代碼添加到項目上後(此處是將demo直接複製粘貼到該項目中),然後提交到gitee上。

#添加文件
git add .
#提交到本地上
git commit -m "add face-api demo"
#上傳到gitee上
git push -u origin master

注意,提交前需要先配置身份信息

git config --global user.email "[email protected]"
git config --global user.name "cceking"

假如沒有下載到本地,則需要關聯遠程庫

git remote add origin https://gitee.com/bottomheater/demo4js.git
#或者是
git remote add origin git@gitee.com:bottomheater/demo4js.git

開啓Pages,過程和github差不多,點擊服務下的gitee pages

這裏寫圖片描述
設置分支和部署目錄(root地址)後點擊啓動,等待一段時間即可。
這裏寫圖片描述

這樣訪問https://bottomheater.gitee.io/demo4js/face-api/即可(這是使用face-api.js進行人臉檢測的demo)。

搭配hexo

順便整理下網上的教程,mark。

初始化hexo項目

npm install hexo -g
hexo init
npm install
npm install hexo-deployer-git --save
#生成靜態文件
hexo g
#啓動服務器
hexo s

新建文件,此時已經新建了hello_world.md並保存在_posts目錄下

hexo new post "hello_world"

修改_config.yml,添加遠程庫

# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
  type: git
  repository: git@gitee.com:bottomheater/demo4js.git
  branch: master

生成並部署到遠程庫

hexo d -g

不過gitee好像會自動根據項目編譯,具體的有空再試。

Jekyll、Hugo、Hexo 編譯判斷依據

  1. 編譯 Hugo 依據:項目編譯目錄下存在config.toml|json|yaml文件和content目錄的時候,會使用hugo生成靜態文件。
  2. 編譯 Hexo 依據:項目編譯目錄下存在package.json_config.yml文件和scaffolds目錄的,會使用hexo generate生成靜態文件,由於每次部署編譯需要重新克隆編譯並進行npm install,所以使用 Hexo 的時間相對 Hugo 和 Jekyll 會長一些。
  3. 當不符合上述1和2條件的時候,就默認使用Jekyll編譯。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章