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

相关推荐
徐小夕5 分钟前
下载量超 30 万的开源智能体 Prime Agent:它把自己从 TypeScript 重写成了 Rust
前端·vue.js·github
全栈陈序员1 小时前
【Git】从入门到精通(十一)—— git reset 三种模式详解
git·elasticsearch
miofly2 小时前
GitHub 日榜趋势速报 | 2026-11-05
开源·github
全栈陈序员4 小时前
【Git】从入门到精通(十)—— 撤销与恢复:git checkout与git restore
运维·网络·数据库·git
全栈陈序员11 小时前
【Git】从入门到精通(五)—— git add:将文件加入暂存区
大数据·git·elasticsearch
wflynn12 小时前
GitHub 日榜趋势速报 | 2026-11-03
开源·github
u13013012 小时前
GitHub 热榜项目:日榜(2026-11-03)
人工智能·github
全栈陈序员14 小时前
【Git】从入门到精通(七)—— git status:查看仓库状态
大数据·git·elasticsearch
GoGeekBaird18 小时前
别再给每个 AI 做自我介绍了:我做了一个「个人上下文」管理系统
后端·github·agent
莫晓燚19 小时前
Ansible 13 个常用模块---企业实战
git·github