设置 GPG 签名 #
见 Codeberg 文档:https://docs.codeberg.org/security/gpg-key/
设置 ssh 连接远程仓库 #
- 见 Codeberg 文档:https://docs.codeberg.org/security/ssh-key/
- 见 Github 文档:https://docs.github.com/zh/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
未知指纹 #
- Github:https://docs.github.com/zh/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints
- Codeberg:https://docs.codeberg.org/security/ssh-fingerprint/
git 子模块 #
这里主要是列举常用的git子模块命令。
注意: 如果远程仓库使用了git子模块,在克隆或拉取这个远程仓库时,git子模块并不会自动初始化或更新。
git子模块添加 #
git submodule add [--depth=1] [--branch name] [submodule-repository-url] [path]--branch: 设置子模块跟踪的分支
git子模块初始化 #
git submodule init [path][path]: 初始化特定子模块
git子模块更新 #
git submodule update [--init] [--recursive] [--remote] [--merge]--init: 加入这个选项后就无需运行git submodule init--recursive: 告诉 Git 检查子模块中的嵌套子模块并更新它们--remote: 使用远程源的新内容更新--merge: 将子模块的上游更改与本地版本合并
git子模块状态 #
git submodule status [--recursive]该命令打印出 SHA-1 和每个子模块的路径。SHA-1 字符串可以具有三个不同的前缀:
-前缀标记未初始化的子模块+标志表明签出的子模块提交与原始子模块存储库的状态不同U前缀会提醒合并冲突--recursive选项可在状态报告中包含嵌套子模块
git子模块删除 #
# Remove the submodule entry from .git/config
git submodule deinit -f path/to/submodule
# Remove the submodule directory from the superproject's .git/modules directory
rm -rf .git/modules/path/to/submodule
# Remove the entry in .gitmodules and remove the submodule directory located at path/to/submodule
git rm -f path/to/submodulegit子模块设置跟踪分支 #
git submodule set-branch --branch main [path]