修改: "GIT\346\212\200\346\234\257.md"
This commit is contained in:
@@ -16,61 +16,22 @@ sudo apt install gitk git-cola 图形化工具
|
||||
git config --global user.email "zimyx@.com"
|
||||
git config --global user.name "Your Name"
|
||||
git config --global credential.helper store 全局级别保存凭据,免密
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### SSH 免密推送配置(你提供的步骤非常重要)
|
||||
|
||||
配置 SSH 密钥后,可以避免每次推送代码时输入密码:
|
||||
|
||||
#### 1. 生成 SSH 密钥对
|
||||
## 基础用法
|
||||
|
||||
```
|
||||
ssh-keygen -t rsa -C "your_email@example.com" 也可用用户名
|
||||
git status
|
||||
git add .
|
||||
git commit -m "更新代码"
|
||||
git push
|
||||
```
|
||||
|
||||
按提示完成三次回车即可生成密钥。查看公钥内容:
|
||||
|
||||
```
|
||||
cat ~/.ssh/id_rsa.pub
|
||||
```
|
||||
|
||||
#### 2. 在 Gitea 中添加 SSH 公钥
|
||||
|
||||
登录 Gitea Web 界面 → 点击右上角头像 → 设置 → SSH/GPG 密钥 → 添加密钥 → 粘贴公钥内容并保存。
|
||||
|
||||
#### 3. 修改远程仓库地址为 SSH 格式
|
||||
|
||||
```
|
||||
# 查看当前远程地址
|
||||
git remote -v
|
||||
|
||||
# 修改为 SSH 地址
|
||||
git remote set-url origin git@gitea.example.com:username/repo.git
|
||||
```
|
||||
|
||||
#### 4. 测试 SSH 连接
|
||||
|
||||
```
|
||||
在服务器上创建 zimy 用户并设置密码:
|
||||
sudo useradd -m -s /bin/bash zimy
|
||||
sudo passwd zimy 设置密码
|
||||
|
||||
|
||||
ssh -T zimy@zgene.cn
|
||||
```
|
||||
|
||||
首次连接会提示信任主机,输入 `yes` 确认。认证成功后会显示欢迎信息。
|
||||
|
||||
|
||||
|
||||
## 分支管理规范
|
||||
## 规范
|
||||
|
||||
分支类型与命名规范
|
||||
|
||||
@@ -218,9 +179,3 @@ git branch -d hotfix/issue-description
|
||||
|
||||
|
||||
|
||||
```
|
||||
git add .
|
||||
git commit -m "更新代码"
|
||||
git push
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user