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安装

相关推荐
大写-凌祁23 分钟前
零基础入门深度学习:从理论到实战,GitHub+开源资源全指南(2025最新版)
人工智能·深度学习·开源·github
悟乙己1 小时前
Github | MoneyPrinterTurbo:自动化视频内容生成系统
自动化·github·音视频
雁于飞2 小时前
vscode中使用git、githup的基操
笔记·git·vscode·学习·elasticsearch·gitee·github
icebreaker6 小时前
tailwindcss 究竟比 unocss 快多少?
前端·css·github
Giant1008 小时前
小白也能看懂的 Git 命令手册:从配置到提交,一步到位
github
ruanCat13 小时前
使用 vite 的 base 命令行参数来解决项目部署在 github page 的路径问题
前端·github
FreeBuf_13 小时前
Salesloft Drift网络攻击事件溯源:GitHub账户失陷与OAuth令牌窃取
安全·github
第七种黄昏13 小时前
GitHub 项目提交完整流程(含常见问题与解决办法)
github
确定过眼神!14 小时前
GitHub提交到公共项目流程
github·changeset
掘我的金15 小时前
mpc4j 在 macOS M3(Apple Silicon)上的部署实录:JDK 21(Preview)与 FourQ 缺失排错
github