Github 常见问题

设置 SSH 登录 Github

  • 生成密钥 (Github 邮箱)

    ssh-keygen -t ed25519 -C "xxx@xxx.com"
    
  • 复制 ~/.ssh/id_ed25519.pub 到Github

  • 复制 ~/.ssh/id_ed25519 到需要登陆的机器 ~/.ssh/

  • 需要登陆的机器终端执行

    eval "$(ssh-agent -s)"
    

同步主线冲突

This branch has conflicts that must be resolved

解决方法

  • 从 main 分支新建一个 merge 备份

  • Discard 所有 main 分支的提交(还原成主线后同步到最新的主线)

  • 解决冲突

    # 拉取最新代码
    git pull
    
    # 查看冲突
    git status
    
    # 处理后提交
    git add . && git commit -m merge && git push
    
  • merge 没啥问题删除 merge 分支