# 一键部署hexo博客

## up.sh的使用

{% hint style="info" %}
在这之前你需要确认你已经配置了SSH秘钥, 如果没有, 具体操作可以看一键生成SSH秘钥教程, 它在上一篇.
{% endhint %}

您需要在存放install.sh脚本的目录中,右键打开git bash运行以下命令:

```bash
source install.sh deploy
```

![下载up.sh](/files/-LlutGTSONJsGgLT-HB3)

{% hint style="info" %}
你需要将up.sh复制到hexoblog文件,也就是复制到你的博客根目录下
{% endhint %}

![](/files/-LluzdSM_MrB7O9qCs1Z)

然后在存放up.sh脚本的目录中,右键打开git bash运行以下命令:

```bash
source up.sh
```

{% hint style="success" %}
之后即可自动部署到你的github或者coding上
{% endhint %}

{% hint style="danger" %}
如果上传失败你需要检查是否安装的是最新版本的\[hexo-script] ,或者在根目录配置了deploy信息.
{% endhint %}

{% hint style="danger" %}
如果你不会配置,可以看下面的教程:
{% endhint %}

## 部署博客必要的配置

首先你需要打开根目录配置文件\_config.yml

![](/files/-LluxHhrwiYvRhAnlHXs)

> 找到deploy,它一般在最后一行,按照以下的格式修改即可

![](/files/-LluyCdpQ92nd8tuqn9Z)

{% hint style="info" %}
你只需要修改repo后面的信息即可
{% endhint %}

```
deploy:
  type: git
  repo: 这里填你的仓库地址,建议使用SSH地址,它是以git开头的
  branch: master
```

在1.3版本的\[heox-script]后你无需自己安装上传插件,但如果报出了not found git的错误证明上传插件没有安装成功,你需要执行以下命令

```
cnpm install hexo-deployer-git --save
或者是npm install hexo-deployer-git --save
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hexoscript.gitbook.io/hexo-script/1.3-1/shi-yong-bu-zhou/yi-jian-bu-shu-hexo-bo-ke.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
