github 推送
# github 推送
# 初始化本地仓库
git init
# 把文件添加到暂存区
git add README.md
# 把暂存区文件提交到本地仓库形成历史记录
git commit -m "first commit"
# 添加远端仓库地址到本地仓库
git remote add origin https://github.com/lipengzhou/toutiao-publish-admin.git
# 推送到远程仓库 -u 就是记住本次推送的信息,下次就不用写推送信息了,可以直接 git push
git push -u origin master
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
之后如果有代码变动需要提交
git add
git commit
# 推送到远程仓库
# 推送的时候如果不改变远程仓库和分支的话就直接
git push
# 如果推送的远程仓库或是分支改变了
$ git push -u 远程仓库 分支名称
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
扩展:管理远程仓库地址信息
# 查看使用帮助
git remote --help
# 查看所有的远程仓库信息
git remote -v
# 添加远程仓库地址信息
git remote add 名称 远程仓库地址
# 删除指定的远程仓库信息
git remote remove 名称
# 修改远程仓库地址信息
git remote set-url 远程仓库地址名称 新地址
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
# GitHub Pages 部署 base 地址配置修改
如果打算将项目部署到 https://.github.io/ 上, publicPath 将默认被设为 "/" ,你可以忽略这个参数。
如果打算将项目部署到 https://.github.io// 上 (即仓库地址为 https://github.com// ),可将 publicPath 设为 "//" 。举个例子,如果仓库名字为 “my-project”,那么 vue.config.js 的内容应如下所示:
module.exports = {
publicPath: process.env.NODE_ENV === "production" ? "/my-project/" : "/"
};
1
2
3
2
3
修改完配置文件只有,要重新构建,然后将新的打包结果推到仓库才能生效。
编辑 (opens new window)
上次更新: 2023/12/06, 01:31:48