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

相关推荐
:-)2 小时前
开源项目二开 Git 规范工作流
git
阿米亚波6 小时前
【C/C++包管理器】vcpkg(by microsoft)
c语言·c++·git·vscode·microsoft·github·vcpkg
苍煜8 小时前
Git Worktree 多工作树实战教学-工作多分支实用教程
git
打工的小王9 小时前
github教程之多人协作
github
笨笨狗吞噬者9 小时前
IRIS: shell 中的智能实时输入提示工具
github·shell
RainingTime11 小时前
新版IDEA使用传统用户名、密码登录Git
git
fthux11 小时前
MCP协议开发实战:从零搭建AI Agent工具链
前端·人工智能·ai·开源·github
@CLoudbays_Martin1112 小时前
Linux 服务器如何查看是否被植入后门?
linux·服务器·网络·安全·github·ssl
一次旅行12 小时前
Ollama本地私有化大模型完整工程实战
人工智能·机器学习·github
华科大胡子12 小时前
GitHub Copilot 能换成本地模型吗?—— 本地化替代方案深度解析
人工智能·github·copilot