GitHub的使用

环境准备

创建仓库

生成token

目前的github上传,不在支持密码,需要使用token

生成本地密钥

ssh-keygen -t rsa -C "email"

查看生成的密钥

将密钥添加到github

代码拉取、推送

初始化本地仓库

git init

将远端仓库与本地仓库链接起来

添加远程配置

git remote add origin https://github.com/\<username>/<repo>.git

git remote set-url origin https://\<your_token\>@github.com/\<username>/<repo>.git

  • <your_token>:刚刚生成的token
  • <username>:github的用户名
  • <repo>:仓库名称

将当前目录下的所有修改过的文件添加到 Git 的暂存区

git add .

绑定邮箱和用户名(先输入下面的第一次创建时的代码)

第一次创建时

git config --global user.name "你的用户名"

git config --global user.email "你的邮箱"

要修改时

git config --replace-all user.name "你的用户名"

git config --replace-all user.email "你的邮箱"

查看当前仓库配置信息

git config --list

查看全局配置信息

git config --global -l

按q退出

将暂存区中的修改提交到本地仓库,并添加提交信息

git commit -m "test"

将当前分支重命名为 main

git branch -M main

拉取分支

git pull --rebase origin main

将本地 main 分支推送到远程仓库,并设置该分支的上游(upstream)跟踪关系

git push --set-upstream origin main

推送

git push

github加速

win自带的商店里面直接搜索Watt Toolkit安装

相关推荐
敖云岚2 小时前
【Redis】Another Redis Desktop Manager 安装指南
java·redis·github
qianmoQ1 天前
GitHub 趋势日报 (2025年04月30日)
github
yovo11 天前
Linux权限管理
linux·运维·github
kyle~2 天前
如何阅读GitHub上的深度学习项目
人工智能·深度学习·github
庐阳寒月2 天前
GitHub修炼法则:第一次提交代码教学(Liunx系统)
linux·github·嵌入式
高效匠人3 天前
Galini AI 技术实现方案及 GitHub 开源库推荐
人工智能·开源·github
opentrending3 天前
Github 热点项目 Qwen3 通义千问全面发布 新一代智能语言模型系统
人工智能·语言模型·github
油泼辣子多加3 天前
2025年04月29日Github流行趋势
github
N1CROWN3 天前
登录github失败---解决方案
github
@ZyuanZhang4 天前
github使用记录
github