# Github常绿养号

By [Mofei](https://paragraph.com/@mofei) · 2024-05-26

---

### **先准备：登录好并打开github首页**

### **第一步：点击 New** repository

![](https://storage.googleapis.com/papyrus_images/3f8627bec136bb8f4b95c199df90b78e09d21e8c11129ccb01d49ba3a6cee6a1.png)

### **第二步：输入项目名称（随意），勾选Add a README file，最后点击Create** repository

![](https://storage.googleapis.com/papyrus_images/4c23e8d2a4d315ed62348811a42e9c89c206c45bce96b6ac566d14577ccc00f1.png)

### **第三步：点击Actions**

![](https://storage.googleapis.com/papyrus_images/20518f24d7fd1d3b87c32c272c0abb933bc82b1ec1f67289112b4207c67a87ac.png)

### **第四步：**

![](https://storage.googleapis.com/papyrus_images/fd83f492cfb38709b08be5102020f57bd13fcb9cfb861e88b6959c024564998c.png)

### **第五步：在如下框中输入自动执行信息**

![](https://storage.googleapis.com/papyrus_images/091f9e36d2b0ab2731142e63fc314807621918e626027fb245b4e1a2d3d6b673.png)

执行信息如下，设置好点击右上角的 **Commit changes...** 即可完成！如需修改执行频率可修改0 \*/6 \* \* \*为其它，本例为6小时提交一次代码。

    
    name: main
    
    on:
      push:
        branches:
          - main
      schedule:
        - cron: "0 */6 * * *"
    permissions:
      contents: write
    jobs:
      autogreen:
        runs-on: ubuntu-latest
        steps:
          - name: Clone repository
            uses: actions/checkout@v2
    
          - name: stick
            run: |
              date > date.txt
              git config --local user.name "自己的github用户名（重要）"
              git config --local user.email "自己的github邮箱（重要）"
              git add date.txt
              git commit --allow-empty -m "updated txt"
              git push

---

*Originally published on [Mofei](https://paragraph.com/@mofei/github)*
