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

相关推荐
Hommy8815 小时前
【开源剪映小助手】调试与故障排除
开源·github·aigc
摆烂z15 小时前
AI同时完成多个功能(Git WorkTree)
git
CoderJia程序员甲16 小时前
GitHub 热榜项目 - 日榜(2026-04-24)
人工智能·ai·大模型·github·ai教程
___波子 Pro Max.20 小时前
Git Worktree 可视化理解指南
git
AI技术增长21 小时前
第 2 集:环境搭建:安装 Claude Code、GitHub CLI 与项目初始化
人工智能·自动化·github
happymaker06261 天前
git使用快速入门
git
MuzySuntree1 天前
Ubuntu 使用 GitHub SSH 克隆时报 Permission denied (publickey) 解决方案
ubuntu·ssh·github
不做超级小白1 天前
从零到可用:在手机上用 Termux + Git + Obsidian 打造稳定同步环境(踩坑全记录)
git·智能手机
凡客丶1 天前
Git安装与使用保姆教程【超详细】
git
android_cai_niao1 天前
给Git项目添加多个远程仓库
git·gitee·github