美文网首页
【Windows】Git环境配置和上传GitHub

【Windows】Git环境配置和上传GitHub

作者: 神梦无痕 | 来源:发表于2021-09-24 06:57 被阅读0次

Git 环境配置(Windows)

零基础、小白都能学会


一、注册 GitHub 账号

注册网址:https://github.com/signup?source=login

二、下载 Git 客户端安装包

官方下载:https://git-scm.com/download/win
腾讯下载:https://pc.qq.com/detail/13/detail_22693.html

三、Git 全局配置

安装包安装完后,就可以在桌面右键
点击 Git Bash Here 选项
就可以开始输入命令了

  1. 输入配置账号命令

     git config --global user.name "你的账号"
    
  2. 输入配置邮箱命令

     git config --global user.name "你的邮箱地址"
    
  3. 输入生成 SSH 公钥命令,然后连续按三次回车就行

     ssh-keygen -t rsa -C "你的邮箱地址"
    
  4. 输入查看公钥字符串命令,然后复制字符串到剪切板

    cat ~/.ssh/id_rsa.pub
    

四、GitHub 配置 SSH Key

  1. 打开创建SSH Key页面:https://github.com/settings/ssh/new
  2. Title 随便填什么都行
  3. Key 把上一步复制到的公钥字符串粘贴上去就行

五、创建远程仓库

  1. 打开新建仓库页面:https://github.com/new
  2. Repository name 填:123
  3. Description 随便填什么都行
  4. 勾选 Public 选项
  5. 其他选项默认就行,不用动
  6. 点击 Create repository 按钮创建

六、上传本地代码到远程仓库

在桌面上创建一个 123 文件夹,并进入该文件夹
右键点击 Git Bash Here 选项
就可以开始输入命令了

  1. 输入创建一个自述文件命令

     echo "# 123" >> README.md
    
  2. 输入初始化一个本地仓库命令

     git init
    
  3. 输入将刚才的自述文件添加到缓存区命令

     git add README.md
    
  4. 输入将缓存区的文件提交到仓库永久存储命令

     git commit -m "第一次提交"
    
  5. 输入切换到主支干命令

     git branch -M master
    
  6. 输入绑定到远程仓库地址命令

    记得一定要用 SSH 的,不要用 HTTPS
    否则等下上传的时候会一直弹账号密码输入框,
    GitHub 现在不允许用账号密码提交了,
    就算输入正确的账号密码也会一直报错。

     git remote add origin git@github.com:你的账号/123.git
    
  7. 输入上传代码命令

     git push -u origin master
    
  8. 输出这个提示则表示成功了!

    To github.com:SMWHff/123.git

    • [new branch] master -> master
      Branch 'master' set up to track remote branch 'master' from 'origin'.

相关文章

  • 【Windows】Git环境配置和上传GitHub

    Git 环境配置(Windows) 零基础、小白都能学会 一、注册 GitHub 账号 注册网址:https://...

  • windows系统下配置多个git账号以及SSH

    本文以配置github.com账号和git.oschina.net账号来逐步演示在Windows环境下配置Git多...

  • git的命令

    git的下载地址:https://git-for-windows.github.io/git环境变量配置:增加:G...

  • Pycharm中使用GitHub

    环境:pycharm 2016,git 2.8,github账户,windows7 一、配置Pycharm 不管你...

  • Git笔记

    安装和配置 https://git-scm.com/https://git-for-windows.github....

  • git版本控制

    1 、下载安装git windows 环境 https://git-for-windows.github.io/ ...

  • git基础

    git上传项目到github 先决条件 github账号 安装git-for-windows工具 步骤 githu...

  • React Native搭建(windows)

    ##1.git配置 git 下载地址:https://git-for-windows.github.io/ git...

  • git使用

    Git安装和使用 Git使用总结 如何将本地项目上传到Github Windows中git bash完全可以替代原...

  • git

    下载与配置 Windows下载地址https://git-for-windows.github.io/ 配置信息g...

网友评论

      本文标题:【Windows】Git环境配置和上传GitHub

      本文链接:https://www.haomeiwen.com/subject/gsbagltx.html