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分支

相关推荐
shandianchengzi2 小时前
【记录】Copilot|Github Copilot重新学生认证通过方法(2025年7月,包括2FA和认证材料、Why are you not on campus)
github·copilot
K1ne_2 小时前
2026 最新版|学生认证白嫖 GitHub Copilot Pro 保姆级教程
github·copilot
cs.shunzhang2 小时前
GitHub 教育认证通过后如何领取 Copilot Pro
github·copilot
程序员柒叔2 小时前
OpenCode 踩坑记:GitHub Copilot 按次计费?我的账单为何暴涨 3 倍!
github·copilot·claude code·opencode
刚刚觉醒的小菜鸡2 小时前
copilot学生认证2026-github copilot学生认证(手把手教会)
github·copilot
徐小夕3 小时前
我花一天时间Vibe Coding的开源AI工具,一键检测你的电脑能跑哪些AI大模型
前端·javascript·github
一乐小哥9 小时前
如何写一个好的 Pull Request
github
Hommy8810 小时前
【开源剪映小助手】云渲染环境搭建
python·开源·github·剪映小助手
Robot_Nav11 小时前
Git 项目维护命令指南相关讲解
git·机器人·github
i建模11 小时前
强制同步远程git仓库
git