GitHub:修订间差异

来自牛奶河Wiki
跳到导航 跳到搜索
第100行: 第100行:


=== Error ===
=== Error ===
* RSA 证书无或错误
==== RSA 证书无或错误 ====
ERROR: Permission to XXX/XXX.git denied to deploy key
fatal: Could not read from remote repository.
-.OR.-
  [email protected]: Permission denied (publickey).
  [email protected]: Permission denied (publickey).
  fatal: Could not read from remote repository.
  fatal: Could not read from remote repository.
# repository 下 settings/Deploy keys 中有相应 RSA publickey
# 客户端中 .ssh 中有相应的 id_rsa(MacOS 使用 ssh-add)
# 不同的 repository 使用不同的 RSA publickey


* 分支冲突,本地版本陈旧  
* 分支冲突,本地版本陈旧  

2024年9月23日 (一) 16:28的版本

GitHub Person

价格计划(免费版)

  • Free
    • The basics for individuals and organizations
  • Unlimited public/private repositories
    • Host open source projects in public GitHub repositories, accessible via web or command line. Public repositories are accessible to anyone at GitHub.com.
  • 2,000 automation minutes/month
    • Free for public repositories
    • Use execution minutes with GitHub Actions to automate your software development workflows. Write tasks and combine them to build, test, and deploy any code project on GitHub.
  • 500MB of Packages storage
    • Free for public repositories
    • Host your own software packages or use them as dependencies in other projects. Both private and public hosting available.
  • New Issues & Projects (beta)
    • Community support
    • 免费(个人)版支持无限个数的私有(或公有)仓库, 每月2000分钟的自动构建时长, 单仓库最大 500M.
    • 查看详情: https://github.com/pricing
    • CI/CD,全称:持续集成 (Continuous Integration) ,持续部署 (Continuous Deployment) ,是开发流程的自动化利器

Git

  • 当前机器中有 id_rsa
  • 远程 github 中已加载 id_rsa.public(settings -> Access -> SSH &GPG keys)

INIT

  • git init
    • 在当前目录下建立 .git 目录
    • clone 的目录在此目录下
git config --global user.name ldscfe
git config --global user.email [email protected]
git config --global color.ui true   # git status等命令自动着色
# git config --list
# 自动判断提交位置(clone多个库)
git config --global push.default matching

Repository

# clone 远程仓库
git clone [email protected]:ldscfe/pangolin.git

# token
Settings -> Developer Settings -> Personal access tokens -> tokens(classic)
# 记录 token
git clone https://<Token Name>:<Token>@github.com/ldscfe/devudefj2.git

# 刷新
git pull

# 增加文件
git status           # 查看文件状态

git add $FN
git add .            # 所有

# 提交 (需要 git add)
git commit -m "comment content"
git push

# 去除文件&目录: .gitignore,已 git add 的文件,在 .gitignore 中标识无效
log/
target/
src/test/
.DS_Store
.gitignore

git rm -f ${FN}      # 已 git add 的文件,删除后.gitignore 中标识有效

# 分支之间切换、恢复文件、创建新分支等
git checkout <branch-name>           # 从当前分支切换到指定的分支 <branch-name>, 或主分支:master
git checkout -                       # 快速切换回前一个分支
git checkout -- <file>               # 将指定文件 <file> 恢复到最新的提交状态,丢弃所有未提交的更改
git checkout -b <new-branch-name>    # 创建一个新分支 <new-branch-name> 并切换
...

# Creating remote repositories
git remote add ldscfe_cpp [email protected]:ldscfe/cpp.git
git remote add ldscfe_pangolin [email protected]:ldscfe/pangolin.git
git remote add ldscfe_udefpy3 [email protected]:ldscfe/udefpy3.git

#You can use the command git remote set-url to change a remote's URL.
git remote set-url <REMOTE_URL> 
# 需要指定下推同步的项目
git config --global push.default matching

Public Effect

settings -> Danger Zone -> Change visibility

  • The code will be visible to everyone who can visit https://github.com
  • Anyone can fork your repository.
  • All push rulesets will be disabled.
  • Your changes will be published as activity.
  • Actions history and logs will be visible to everyone.

Error

RSA 证书无或错误

ERROR: Permission to XXX/XXX.git denied to deploy key
fatal: Could not read from remote repository.
-.OR.-
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
  1. repository 下 settings/Deploy keys 中有相应 RSA publickey
  2. 客户端中 .ssh 中有相应的 id_rsa(MacOS 使用 ssh-add)
  3. 不同的 repository 使用不同的 RSA publickey
  • 分支冲突,本地版本陈旧
Automatic merge failed; fix conflicts and then commit the result.
# 丢弃本地分支内容
git reset --hard origin/master
  • fatal: Not a git repository (or any of the parent directories): .git
git remote add 时出现,原因:未 git init
  • fatal: Could not read from remote repository
git pull 时出现
ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.