一、下载并安装git
1.git下载地址 https://git-scm.com/
2.git安装一直下一步即可
二、vscode中git设置
点击左下角的设置》settings,然后在搜索中输入git.path

点击Edit in settings.json

在右边输入git的安装路径(设置是json格式的,用户设置会覆盖默认设置)
三、使用git做版本管理
1.版本库初始化

依次点击图中1和2,


2.代码commit
注:git中commit只是提交到本地,与svn不同

如提交失败,需要在终端中设置git全局变量
git config --global user.name "xxx"
git config --global user.name "xx@yy.com"
如下图:

设置完成后重新commit即可
3.将代码提交到github(或者其他git服务器)




登陆github查看代码是否已提交

网友评论