Git配置,用vscode编写代码并提交进github

    技术2025-11-01  2

    Git配置,用vscode编写代码并提交进github

    Git工作大致原理电脑配置Git步骤—github仓库clone远程仓库+配置下面是本地编辑并提交到github的一般步骤(不用VScode的情况下)addcommitpush pull和checkoutpullcheckout VS Code 编写代码如何提交到github仓库

    Git工作大致原理

    1_add 2_commit 3_push pull workspace 文件 Repository Remote

    电脑配置Git步骤—github仓库

    clone远程仓库+配置

    去官网下载Git; git官网 打开github(或新建)一个仓库,记下仓库地址; 配置用户名和邮箱(github注册邮箱): 打开下载好的 git bash,输入: (ps:复制粘贴会失灵+空格不可少+两个“-”之间没有空格) git config - -global user.name '你的用户名’git config - -global user.email '你的email’git clone '你的仓库地址’ 全程英文输入 不显示出错再输入下一步 这时桌面会出现一个和仓库同名的文件夹;

    下面是本地编辑并提交到github的一般步骤(不用VScode的情况下)

    add

    在文件夹里新建一个文件 这里我用 a.html 为例;git bash 输入: cd 你的文件夹名字 git add a.html

    commit

    git bash 输入: git commit -m 'a.html’

    push

    git bash 输入: git push 等待一会儿 第一次会跳出登录界面,需要登录github; 登录之后就提交完成,登录github的仓库会发现文件出现;

    pull和checkout

    pull

    git bash 输入: git pull 从github仓库下载最新项目

    checkout

    git bash 输入: git checkout 找回原先的项目

    VS Code 编写代码如何提交到github仓库

    下载Git插件:GitLens — Git supercharged

    打开项目文件夹——编辑文件并保存打开左端的 源代码管理器 ,查看更改的文件按“+”号 暂存更改按“√” 提交——输入提交信息——enter键按"√"后面的"···" ——推送完成
    Processed: 0.009, SQL: 9