• git同步GitHub,部署GitHubPage


    安装git。地址:https://git-scm.com/download。分为压缩包版(Portable)和安装版(Installer)的。

    本地仓库

    # 进入想要同步的文件夹,初始化git仓库
    git init
    #配置用户信息,如果要提交,就和github一致
    git config --global user.email "user"
    git config --global user.name "user@mail.com"
    # 添加版本控制
    git add .  # 暂存区
    git commit -m "1"
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    推送远程仓库

    # 和远程仓库关联
    git remote add origin [github仓库地址]
    git remote -v #查看关联情况
    # 推送GitHub
    git branch -M main #gitee和git都是master分支,GitHub是main  
    git push -u origin master:main
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    ssh key

    $ ssh-keygen -f id_rsa_github
    $ vim ~/.ssh/id_rsa_github
    Host github.com
    HostName github.com
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa_github
    
    $ ssh -T git@github.com
    You've successfully authenticated, but GitHub does not provide shell access.
    
    $ git remote add origin [仓库ssh地址]
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    token

    GitHub -> settings —> 生成token

    token=github_pat_11AUDXGPY0Dv7BLYBB4S3S2BLQUE0JXP3Rk...
    set url=https://github.com/Vin0sen/test.git
    set address=%url:~0,8%%token%@%url:~8,36%
    echo %address%
    git remote add origin %address%
    
    • 1
    • 2
    • 3
    • 4
    • 5

    Github Page

    新建仓库。❗ 注意的是userName是Account中的,而不是Public profile中的Name。

    如果仓库名为[userName].github.io,可以直接通过该仓库名访问到Github Page的主页。

    如果不一致,访问地址为 https://[userName].github.io/[repository]

    进入该仓库,把本地文件推送进来,Settings—> Pages,设置一下就好,很简单

    有非常多的第三方的静态模板系统来搭建 GitHub Pages。比如:

    • Ruby编写的Jekyll
    • Node.js 编写的 Hexo
    • Go 编写的 Hugo
    • Python 编写的 Pelican

    Refer

    • https://blog.csdn.net/qq_42203909/article/details/120346639
  • 相关阅读:
    详解FreeRTOS:FreeRTOS任务创建过程源码分析(进阶篇—1)
    ResultSet底层和Statement
    【Java 进阶篇】Java Request 原理详解
    MySQL高级SQL语句(一)
    Linux基本指令
    JavaScript涉及二进制的转换
    Thread线程异常的处理方式
    neo4j
    linux升级glibc-2.28
    大数据技术之Sqoop
  • 原文地址:https://blog.csdn.net/m0_52062236/article/details/127448969