github 笔记
github 杂记
加速下载 github 代码
- 登录码云—>点击新建仓库—>点击导入已有仓库—>粘贴 github 仓库地址—>点击创建—>好了后直接下载即可
github 获取:token
- 方法一. 右上角—>Settings—>Developer settings—>左边分别有 github OAuth 个人访问,根据需要选择
- 方法二. 登录后 直接访问 https://github.com/settings/tokens or https://github.com/settings/tokens/new
github token push
https://cxvh:${GITHUB_TOKEN}@github.com/cxvh/blogs.git
git config --global user.name "cxvh"
git config --global user.email "***@qq.com"
发布一个 github packages
- 初始化 package.json
npm init --scope=cxvh
中的cxvh
必须是你的github用户名,其他随便填写一些description和author,然后一路回车就好。- Step 1: 添加
publishConfig
到package.json
"publishConfig": { "registry": "https://npm.pkg.github.com/" }
- Step 2: 登录
name
为github
登录账号,密码用github
的token
,上面有生成方法,邮箱用github
邮箱npm login --registry=https://npm.pkg.github.com/
package.json
name
格式为@登录名/包名
如:@cxvh/hello-world-npm
- Step 3: Publish
npm publish
github action 配置
根据时间自动构建,文档
1 | # ┌───────────── minute (0 - 59) |
push
或者 pull_request
触发构建
1 | on: |
action克隆到当前仓库示例
1 | name: 每天自动同步仓库 |
报错解决记录
密钥
- win生成密钥
ssh-keygen
写入权限不够报错1
Saving key "\033[A\033[B/c/Users/Baran.Lee/.ssh/id_rsa)\033[D\033[D\033[C\033[\033[D\033[D\033[D\033[D\033[D\033[Dcodeba/id_rsa" failed: No such file or directory
- 进入文件夹
C:\Users\用户\.ssh\gitlab
再执行ssh-keygen
命令
git rebase
- 历史中不连续的
commit
合并git rebase -i head~3
,然后报错如下:1
2
3
4
5
6
7
8
9
10
11interactive rebase in progress; onto bbef1ea
No commands done.
Next commands to do (3 remaining commands):
s ae093ef 更新 circleci 配置文件
s 1ab23ac 更新 circleci 配置文件2
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch 'main' on 'bbef1ea'.
(use "git commit --amend" to amend the current commit)
(use "git rebase --continue" once you are satisfied with your changes)
nothing to commit, working tree clean - 回到rebase执行之前的状态
git rebase --abort
git push
git push orgin main
1
2
3
4
5
6
7
8
9
10
11
12fatal: 'orgin' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
#
$ git push orgin主要
致命的:“orgin”似乎不是git存储库
致命:无法从远程存储库读取。
请确保您具有正确的访问权限
并且存储库存在。- 删掉.git目录,重新配置 git init…
git push提交会提示
1 | fatal: unable to access 'https://github.com/cxvh/cxvh-cli-test.git/': OpenSSL SSL_connect: Connection was reset in connection to github.com:443 |
https
链接改为ssh
链接即可:git remote set-url origin git@github.com:cxvh/cxvh-cli-test.git
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 BARAN的小站🔥🔥🔥!