前言

GIT是每个程序员必须使用到的工具,下面讲述如何在VScode中使用GIT


一、安装配置GIT

1.1 Download for Linux and Unix

https://git-scm.com/download/linux

1.2 Windows

https://www.cnblogs.com/qijunjun/p/7137207.html

1.3 设置全局参数

git config --global user.name “your name”
git config --global user.email “your email”

二、在VScode中使用Git

在需要初始化的GIT仓库中,打开终端
git init
touch README.md
git add README.md
git commit -m “first init”
git remote add origin xxx(xxx是你远程仓库的URL)
git push -u origin master:your_new_branch (your_new_branch是你推送到远程的分支名,如果直接推送master分支,则可以使用git push -u origin master)

2.1 安装VScode中Git的插件

Git History 版本管理
GitLens - gitsupercharge 日志管理
在VScode中使用GIT

2.2 提交代码

2.2.1 点击+号,把所有文件提交到暂存区。

在VScode中使用GIT

2.2.2 commit

在VScode中使用GIT

2.2.3 push

在VScode中使用GIT

2.2.4 输入username与userpassword

正常输入正确的情况下,可以在gitlab,github或其他git上看到提交的修改。

问题描述:

git push 报 HTTP Basic: Access denied 错误
原因:本地git配置的用户名、密码与gitlabs上注册的用户名、密码不一致。


总结

以上就是今天要讲的内容,本文仅仅简单介绍了GIT在VScode的使用,而VScode提供了大量能使我们快速便捷地编程的插件。

相关文章:

  • 2021-09-07
  • 2022-01-18
  • 2021-11-08
  • 2022-12-23
  • 2021-07-16
  • 2021-10-18
猜你喜欢
  • 2022-01-01
  • 2021-11-14
  • 2021-12-06
  • 2021-10-02
  • 2021-05-15
相关资源
相似解决方案