git提交代码github

git提交代码github

  1. git init 初始化仓库

  2. 添加用户邮箱和名字

    • git config --global user.email " github邮箱"
    • git config --global user.name " github账户名"
  3. 配置ssh密钥

    1. ssh-keygen -t rsa 获取ssh公钥
    2. cat ~/.ssh/id_rsa.pub>查看密钥
    3. 到github中配置密钥
  4. 到github中创建仓库,获取ssh 地址

  5. 添加远程仓库

    此操作是先初始化本地仓库,然后与已经创建的远程仓库进行对接。

    • 命令:git remote add <远端名称> <仓库路径>
      • 远端名称 ,默认是origin ,取决于远端服务器设置
      • 仓库路径,从远端服务器获取URL
      • 查看仓库git remote
  6. 修改端口

    1. vim ~/.ssh/config

    2. 在config添加

      Host github.com

      Hostname ssh.github.com

      Port 443

  7. 添加文件到github仓库

    1. git add .将所有修改的文件添加暂存区

    2. git commit 添加文件修改注释

    3. git push origin master推送到仓库master分支

相关推荐
wflynn23 分钟前
GitHub 日榜趋势速报 | 2026-10-10
开源·github
fthux1 小时前
开源小工具 Who Arrives:看看你的公网 IP、地区、时区和网络
http·开源·github
来自于狂人1 小时前
GitHub 开源趋势日报 | 2026年10月10日,告别 Mermaid 的图表设计系统
开源·github
u1301302 小时前
GitHub 热榜项目:日榜(2026-10-10)
人工智能·github
Python测试之道3 小时前
GitHub 实战课|Playwright MCP:让 AI 真的会用浏览器
人工智能·github
鶴哥只手遮天4 小时前
Git 2.56 源码深度剖析:为 Git 3.0 铺路的架构重构
git·开源
小陈运维4 小时前
GitHub Actions + Docker + ACR + GHCR 自动化构建与发布
github
miofly5 小时前
AI 智能体用 83% 字节精确匹配反编译完整游戏
开源·github
小此方6 小时前
「插曲:Git」标签管理篇:理解Tag标签、为指定提交打标签、查看标签详情与附注标签
git
Madison-No77 小时前
多语言聊天大模型--测试报告
linux·git·python·selenium·jmeter·自动化·postman