xb18
xb18
文章39
标签0
分类0
git

git

image-20230903233755265

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 配置  local仓库级别 、global用户级别、system 对系统所有用户有效
git config --global user.name "xb18"
git config --global user.email "450010494@qq.com"

# 查看配置
git config user.name
git config user.email
git config --list --global

# 生成ssh
ssh-keygen -t rsa -C "XX@XX.com"

# 设置代理
git config --global http.proxy 'http://ip:端口号'

# 测试
ssh -T git@github.com

# git初始化
echo "# bot-pc" >> README.md
git init
git add README.md # git add -A
git commit -m "first commit"
git branch -M main

# 本地代码推送到已有仓库
git remote add origin git@github.com:xb18/bot-pc.git
git branch -M main
git push -u origin main

# 常用命令
git clone http://XXXX # 克隆远程仓库到本地
git add -A # 添加到暂存区
git commit -m "commit message" #提交
git branch # 查看本地分支 -a 查看本地和远程
git checkout test # 切换分支test 添加 -b 可以创建并切换到test
git pull # 更新代码
git push # 推送到远程仓库 --force 强制
git status # 查看文件状态
本文作者:xb18
本文链接:http://xb18.github.io/2023/03/21/git/
版权声明:本文采用 CC BY-NC-SA 3.0 CN 协议进行许可