【GitHub】Github远程仓库快速入门指南

1.安装git(ubuntu)

sudo apt update
sudo apt install git

2.配置git用户信息

# 全局配置(推荐)
git config --global user.name "你的名字"
git config --global user.email "你的邮箱"

# 或者在特定项目中配置
cd /your/project/path #有.git文件夹的目录
git config user.name "你的名字"
git config user.email "你的邮箱"

# 检查配置
git config --global --list
git config --list

3.生成ssh密钥

# 生成 SSH Key(如果还没有,检查~/.shh/文件夹下有没有.pub文件)(一直回车即可)(注意:这里的邮箱必须是GitHub使用的真实邮箱)
ssh-keygen -t rsa -b 4096 -C "你的GitHub注册邮箱" #rsa加密的密钥
# 或者
ssh-keygen -t ed25519 -C "你的GitHub注册邮箱" #ed25519加密的密钥
# 查看并复制
cat ~/.ssh/rsa.pub
# 或者
cat ~/.ssh/ed25519.pub

4.配置GitHub SSH密钥(在GitHub用户设置中添加ssh_key,粘贴入公钥)
5.接下来你就可以对你的github仓库为所欲为了:

# 克隆
git clone git@github:你的GitHub用户名/你的Github仓库名.git
# 同步(下载+合并)
git pull
# 拉取 (只下载)
git fetch
# 推送
git push
posted @ 2025-12-05 16:02  zhiao-bowen  阅读(4)  评论(0)    收藏  举报