visual studio code使用git

1、首先在系统path路径中配置好git的bin目录,打开visual studio code的时候就会自动识别到git。
2、在github或者码云等创建仓库,复制仓库地址。
3、初始化
在这里插入图片描述
4、连接远程代码仓库,在terminal窗口输入

git remote add origin 仓库地址
git pull origin master

5、这个时候会报错:

 The current branch master has no upstream branch.

第一次push,远程仓库还没有与之建立tracing关系的分支,所以需要设置upstream,这个设置一次之后,后面再push的时候就不用设置了。
运行代码:

git push --set-upstream origin master

我这里用master分支,如果其他分支,master换成分支名。
6、然后就可以愉快的commit/push代码了。

参考:Visual Studio Code 使用Git进行版本控制

发布了216 篇原创文章 · 获赞 91 · 访问量 25万+

猜你喜欢

转载自blog.csdn.net/yu75567218/article/details/100538529