Git笔记

GPG&SSH

###命令

1
2
3
4
5
6
7
8
9
10
11
# 生成gpg秘钥:
gpg --full-generate-key

# 获取当前的私钥列表
gpg --list-secret-keys --keyid-format=long

# 导出公钥(直接使用生成秘钥时返回的公钥id)
gpg --armor --export {id}

# 生成ssh秘钥:
ssh-keygen -t ed25519 -C {noreply-email}

Git

###命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 快速设置
git config --global user.name *
git config --global user.email *
git config --global commit.gpgsign true
git config --global tag.gpgSign true
git config --global user.signingkey *

# clone单分支
git clone *repo *dir -branch * --single-branch

git pull
git pull --rebase

git checkout main

git diff --name-only

# 临时储存分支更改而不提交
git stash

git log --show-signature

###加速git-bash

  • 使用反代
    首先启动s302本地反代或watt toolkit的,启用github加速

    git全局设置(git config --global --edit)添加:

    1
    2
    3
    4
    5
    #此处`https`可换为`http`
    [https]
    proxy=https://127.0.0.1/
    sslBackend=schannel #使用系统证书服务
    sslVerify=true #默认为`true` 如果git无法使用系统证书才应禁用该项
  • 使用镜像

    使用git remote set-url origin https://kkgithub.com/{username}/{repo}替换本地repo远程地址即可,kkgithub会自动转发

    镜像也可以用来辅助clone大仓库,完事了再改回origin即可

Github

论看官方文档的重要性

PR Review

实际上每个pr的review选项卡需要手动点击Review

否则在自己有外部贡献者的repo下,merge即喜提YOLO徽章(合并未经审核的PR)

匿名提交

本地commit可以用虚拟个人信息,只要你传得上repo

但是无论如何都有activity记录