推送项目到GitHub

步骤 1:生成 SSH 密钥(如果没有)
bash 复制代码
ssh-keygen -t rsa -C "你的GitHub邮箱"

一路回车,生成 ~/.ssh/id_rsaid_rsa.pub

步骤 2:添加公钥到 GitHub
  1. 打开 C:\Users\你的用户名\.ssh\id_rsa.pub 文件

  2. 复制内容

  3. 登录 GitHub → 右上角头像 → SettingsSSH and GPG keysNew SSH key → 粘贴保存

步骤 3:修改远程仓库为 SSH 地址
bash 复制代码
git remote set-url github git@github.com:226211/niubi.git
步骤 4:测试 SSH 连接
bash 复制代码
ssh -T git@github.com

第一次运行会提示输入 yes,然后看到:

bash 复制代码
Hi 226211! You've successfully authenticated...
步骤 5:推送代码
bash 复制代码
git push github master

💡 SSH 一旦设置好,今后推送/拉取都不需要输账号密码,且不会受 HTTPS 网络限制影响。

相关推荐
AxonoSensei1 小时前
4 利用annaconda进行环境搭建
github
时间裂缝里的猫-O-1 小时前
@Linux问题 :bash fork Cannot allocate memory 错误分析与解决方案
linux·chrome·bash
在狂风暴雨中奔跑3 小时前
免费打造你的个人网页——GitHub Pages使用指南
github
小华同学ai4 小时前
Github 2.3k star 太牛x,京东(JoyAgent‑JDGenie)这个开源项目来得太及时啦,端到端多智能体神器!!!
前端·后端·github
dream_home84074 小时前
github 上传代码步骤
github
小华同学ai4 小时前
炸裂!Github 6000+ star 开源免费易用,支持1000+格式转换,值得收藏!
前端·后端·github
handsomestWei14 小时前
github jekyll博客SEO搜索引擎优化
搜索引擎·github·seo·jekyll
叔叔别拉了我害怕20 小时前
封装FTPSClient连接ftps服务器
服务器·git·github
CoderJia程序员甲21 小时前
GitHub 热榜项目 - 日榜(2025-08-21)
ai·开源·github·ai编程
___波子 Pro Max.1 天前
GitHub Actions YAML命令使用指南
github