99re热这里只有精品视频,7777色鬼xxxx欧美色妇,国产成人精品一区二三区在线观看,内射爽无广熟女亚洲,精品人妻av一区二区三区

Hexo 一鍵部署

2020-10-20 16:47 更新
  1. 安裝 hexo-deployer-git。
$ npm install hexo-deployer-git --save
  1. 修改配置。
deploy:
type: git
repo: <repository url> #https://bitbucket.org/JohnSmith/johnsmith.bitbucket.io
branch: [branch]
message: [message]
參數(shù) 描述 默認(rèn)
repo 庫(Repository)地址
branch 分支名稱 gh-pages (GitHub) coding-pages (Coding.net) master (others)
message 自定義提交信息 Site updated: {{ now('YYYY-MM-DD HH:mm:ss') }})
token Optional token value to authenticate with the repo. Prefix with $ to read token from environment variable
  1. 生成站點文件并推送至遠(yuǎn)程庫。執(zhí)行 hexo clean && hexo deployYou will be prompted with username and password of the target repository, unless you authenticate with a token or ssh key.hexo-deployer-git does not store your username and password. Use git-credential-cache to store them temporarily.
  2. 登入 Github/BitBucket/Gitlab,請在庫設(shè)置(Repository Settings)中將默認(rèn)分支設(shè)置為_config.yml配置中的分支名稱。稍等片刻,您的站點就會顯示在您的 Github Pages 中。

這一切是如何發(fā)生的?

當(dāng)執(zhí)行 hexo deploy 時,Hexo 會將 public 目錄中的文件和目錄推送至 _config.yml 中指定的遠(yuǎn)端倉庫和分支中,并且完全覆蓋該分支下的已有內(nèi)容。

For 使用 Git 管理站點目錄的用戶由于 Hexo 的部署默認(rèn)使用分支 master,所以如果你同時正在使用 Git 管理你的站點目錄,你應(yīng)當(dāng)注意你的部署分支應(yīng)當(dāng)不同于寫作分支。 一個好的實踐是將站點目錄和 Pages 分別存放在兩個不同的 Git 倉庫中,可以有效避免相互覆蓋。 Hexo 在部署你的站點生成的文件時并不會更新你的站點目錄。因此你應(yīng)該手動提交并推送你的寫作分支。

此外,如果您的 Github Pages 需要使用 CNAME 文件自定義域名,請將 CNAME 文件置于 source 目錄下,只有這樣 hexo deploy 才能將 CNAME 文件一并推送至部署分支。

Heroku

安裝 hexo-deployer-heroku

$ npm install hexo-deployer-heroku --save

修改配置。

deploy:
type: heroku
repo: <repository url>
message: [message]
參數(shù) 描述
repo Heroku 庫(Repository)地址
message 自定提交信息 (默認(rèn)為 Site updated: {{ now('YYYY-MM-DD HH:mm:ss') }})

Netlify

Netlify 是一個提供網(wǎng)絡(luò)托管的綜合平臺。它集持續(xù)集成(CI)CDN 自定義域名 HTTPS 持續(xù)部署(CD)等諸多功能于一身。您可以通過以下兩種方式將 Hexo 站點部署到 Netlify。

首先,也是最通用的方式,就是使用 Netlify 提供的網(wǎng)頁端用戶界面。前往新建一個網(wǎng)站頁面,選擇需要關(guān)聯(lián)的 Github/BitBucket/Gitlab 庫,然后遵循網(wǎng)站提示。

另一種方式是使用 Netlify 提供的命令行客戶端工具 Node based CLI 管理和部署您的站點。

此外,您還可以在項目的README中增加一個 部署至Netlify按鈕,這樣其他用戶在 fork 或 clone 了您的項目之后可以方便快捷地一鍵部署。

Rsync

安裝 hexo-deployer-rsync。

$ npm install hexo-deployer-rsync --save

修改配置。

deploy:
type: rsync
host: <host>
user: <user>
root: <root>
port: [port]
delete: [true|false]
verbose: [true|false]
ignore_errors: [true|false]
參數(shù) 描述 默認(rèn)值
host 遠(yuǎn)程主機(jī)的地址
user 使用者名稱
root 遠(yuǎn)程主機(jī)的根目錄
port 端口 22
delete 刪除遠(yuǎn)程主機(jī)上的舊文件 true
verbose 顯示調(diào)試信息 true
ignore_errors 忽略錯誤 false
rsync 部署模塊的工作方式需要注意的是,要求您提供的實際上是一個能通過 SSH 登陸遠(yuǎn)程主機(jī)的 Linux 用戶。Hexo 會自動處理關(guān)于rsync 使用的一切操作。因此,您需要在遠(yuǎn)程主機(jī)上為您的 Hexo 站點建立一個用戶,并允許其通過 SSH 登陸。不過,這里的port,的確是指 rsync 監(jiān)聽的端口,請確保防火墻打開了該端口。

OpenShift

安裝 hexo-deployer-openshift。

$ npm install hexo-deployer-openshift --save

修改配置。

deploy:
type: openshift
repo: <repository url>
message: [message]
參數(shù) 描述
repo OpenShift 庫(Repository)地址
message 自定提交信息 (默認(rèn)為 Site updated: {{ now('YYYY-MM-DD HH:mm:ss') }})

FTPSync

安裝 hexo-deployer-ftpsync。

$ npm install hexo-deployer-ftpsync --save

修改配置。

deploy:
type: ftpsync
host: <host>
user: <user>
pass: <password>
remote: [remote]
port: [port]
ignore: [ignore]
connections: [connections]
verbose: [true|false]
參數(shù) 描述 默認(rèn)值
host 遠(yuǎn)程主機(jī)的地址
user 使用者名稱
pass 密碼
remote 遠(yuǎn)程主機(jī)的根目錄 /
port 端口 21
ignore 忽略的文件或目錄
connections 使用的連接數(shù) 1
verbose 顯示調(diào)試信息 false
FTP 部署可能出現(xiàn)的問題您可能需要預(yù)先通過其他方式將所有文件上傳到遠(yuǎn)程主機(jī)中。否則初次使用 ftpsync 插件就可能出現(xiàn)報錯。另外,由于 FTP 協(xié)議的特征,它每傳送一個文件就需要一次握手,相對速度較慢。

SFTP

安裝 hexo-deployer-sftp

$ npm install hexo-deployer-sftp --save

修改配置。

deploy:
type: sftp
host: <host>
user: <user>
pass: <password>
remotePath: [remote path]
port: [port]
privateKey: [path/to/privateKey]
passphrase: [passphrase]
agent: [path/to/agent/socket]
參數(shù) 描述 默認(rèn)值
host 遠(yuǎn)程主機(jī)的地址
user 使用者名稱
pass 密碼
remotePath 遠(yuǎn)程主機(jī)的根目錄 /
port 端口 22
privateKey ssh私鑰的目錄地址
passphrase (可省略)ssh私鑰的密碼短語
agent ssh套接字的目錄地址 $SSH_AUTH_SOCK

Vercel

Vercel is a cloud platform that enables developers to host Jamstack websites and web services that deploy instantly, scale automatically, and requires no supervision, all with zero configuration. They provide a global edge network, SSL encryption, asset compression, cache invalidation, and more.

Step 1: Add a build script to your package.json file:

{
"scripts": {
  "build": "hexo generate"
}
}

Step 2: Deploy your Hexo Website to Vercel

To deploy your Hexo app with a Vercel for Git Integration_blank, make sure it has been pushed to a Git repository.

Import the project into Vercel using the Import Flow_blank. During the import, you will find all relevant options preconfigured for you; however, you can choose to change any of these options, a list of which can be found here_blank.

After your project has been imported, all subsequent pushes to branches will generate Preview Deployments_blank, and all changes made to the Production Branch (commonly “main”) will result in a Production Deployment_blank.

Alternatively, you can click the deploy button below to create a new project

Deploy Vercel

21云盒子

  1. 在 21云盒子中, 創(chuàng)建一個新的 靜態(tài)網(wǎng)頁,然后使用以下設(shè)置:
  • 構(gòu)建命令: yarn && hexo deploy
  • 發(fā)布目錄: public
  1. 點擊 “部署” 按鈕!

樣例已經(jīng)部署在 https://hexo.21yunbox.com/.

Bip

Bip is a commercial hosting service which provides zero downtime deployment, a global CDN, SSL, unlimited bandwidth and more for static websites. Plans are available on a pay as you go, per domain basis.

Getting started is quick and easy, as Bip provides out the box support for Hexo. This guide assumes you already have a Bip domain and Bip CLI installed.

1: Initialise your project directory

$ bip init

Follow the prompts, where you’ll be asked which domain you’d like to deploy to. Bip will detect that you’re using Hexo, and set project settings like the source file directory automatically.

2: Deploy your website

$ hexo generate —deploy && bip deploy

After a few moments, your website will be deployed.

其他方法

Hexo 生成的所有文件都放在 public 文件夾中,您可以將它們復(fù)制到您喜歡的地方。


以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號