GitHub新建项目并发布

一 、新建项目

GitHub官网:https://github.com

1、点击个人头像–>点击Your repositories -->点击New


2、输入项目名称music-lrc–>Public【公开】–>Create repository【创建存储库】

3、将本地仓库与 GitHub 上的远程仓库关联并推送代码

1
2
3
4
5
6
7
echo "# music-lrc" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/meimolihan/music-lrc.git
git push -u origin main

4、将本地仓库推送到GitHub

branch 'main' set up to track 'origin/main'.
说明本地的 main 分支已经设置为跟踪远程仓库 origin 的 main 分支。后续再使用 git pushgit pull 时,如果不指定分支,Git 就会默认操作这个跟踪关系对应的分支。

5、切换为SSH连接GitHub

1
git remote set-url origin git@github.com:meimolihan/music-lrc.git

6、Linux 查看 GitHub 仓库容量

1
curl -s https://api.github.com/repos/meimolihan/meimolihan.github.io | jq '.size'
1
2
3
4
root@Debian-LXC ~ # curl -s https://api.github.com/repos/meimolihan/meimolihan.github.io | jq '.size'
844163
## 已经成功使用 GitHub API 获取到了仓库 meimolihan/meimolihan.github.io 的大小信息。API 返回的这个数值 844163 单位是 KB。
## 换算成 MB:因为 1 MB = 1024 KB,所以该仓库大小换算成 MB 约为 844163 ÷ 1024824.38 MB。

二 、发布 Release 版本




三 、CDN 加速 github

1 、复制文件地址

我的github文件地址:https://github.com/meimolihan/music-lrc/blob/main/一万个理由-郑源.lrc

2 、CDN 免费加速网址

使用说明:
根端点始终是https://cdn.jsdelivr.net
加载任何 GitHub 版本、提交或分支:/gh/user/repo@version/file
https://cdn.jsdelivr.net/gh/user/repo@version/file
user为你的github用户名
repo为你的github项目名称
version为你的github项目Tags版本
file为你的github发布的文件名称

3 、我的CDN 加速地址:

https://cdn.jsdelivr.net/gh/meimolihan/music-lrc@1.0.0/一万个理由-郑源.lrc

四 、更新 Tags 1.0.0 内容

  1. 删除本地标签
1
git tag -d 1.0.0
  1. 删除远程标签
1
git push origin :refs/tags/1.0.0
  1. 为新提交打标签
1
git tag 1.0.0
  1. 将新标签推送到远程仓库
1
git push origin 1.0.0