Windows+VScode+git 备忘

本文详细介绍了如何在VSCode中安装和配置Git,包括设置git路径,clone仓库,解决git掉线问题,添加和提交文件,以及关联和推送至GitHub的过程。
摘要由CSDN通过智能技术生成

1.下载安装git

记住安装路径

2.在vscode中配置git

选择settings

在输入框中输入git.path,打开文件。

修改填入自己的git路径,是文件git.exe所在路径。

然后关闭 VScode ,重启VScode。

3.clone 仓库

重启后点击source control,选择clone Repository。

=========================================================================

git 掉线后修复

  1. 打开项目: 在 VS Code 中打开您要上传至 GitHub 的项目。

  2. 初始化 Git 仓库: 如果项目尚未是一个 Git 仓库,您需要在项目文件夹中打开终端并执行以下命令:

    git init
    

  3. 添加文件到暂存区: 执行以下命令将项目文件添加到 Git 的暂存区:这会将当前目录下的所有文件添加到暂存区。

    git add .
    
  4. 提交更改: 执行以下命令提交暂存区的更改到本地仓库:替换 "Your commit message here" 为您的提交信息。

    git commit -m "Your commit message here"
    
  5. Terminal提示,根据提示输入email和username

    *** Please tell me who you are.
    
    Run
    
      git config --global user.email "you@example.com"
      git config --global user.name "Your Name"
    
    to set your account's default identity.
    Omit --global to set the identity only in this repository.
    
    fatal: unable to auto-detect email address (got 'yangy@LAPTOP-TGP6NUK5.(none)')
    PS F:\fundDataSample> git config --global user.email "email"
    PS F:\fundDataSample> git config --global user.name "username"
    PS F:\fundDataSample> git commit -m "ui_input"

    再次commit

     git commit -m "your commit message"

  6. 连接到 GitHub 仓库: 在 GitHub 上创建一个新的仓库,然后执行以下命令将本地仓库与远程 GitHub 仓库关联起来:将 <GitHub repository URL> 替换为您的 GitHub 仓库的 URL。

    git remote add origin <GitHub repository URL>
    
  7. 推送到 GitHub: 执行以下命令将本地仓库的更改推送到 GitHub:这会将本地的 master 分支推送到 GitHub 上的 master 分支。如果您希望将其他分支推送到 GitHub,可以将 master 替换为您要推送的分支名称。

    git push -u origin master
    
  8. 输入凭据: 当您执行 git push 命令时,Git 可能会提示您输入 GitHub 的用户名和密码来验证推送操作。

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值