第零步: 参考: https://www.cnblogs.com/lxwphp/p/8728564.html
第一步: 远程创建一个仓库, 添加一个文件, 比如 README.md
第二步: VS 创建一个解决方案
第三步: 使用 git init
或者小乌龟在.sln
目录初始化本地git仓库
第四步: 添加一个 .gitignore
文件, 内容可参考: https://github.com/github/gitignore/blob/main/VisualStudio.gitignore, 内容在最后
第五步: 使用 vs 的 git更改菜单可以进行本地提交, 此时有必要的话, 可以对.gitignore
进行一个修正, 如果没有此窗口, 可以通过视图->git 更改调出.
第六步: 打开 git 命令行, 关联远程git仓库
git remote add origin 远程仓库地址
第七步: pull
git pull --rebase origin master
第八步: push
git push -u origin master
之后的操作与正常git操作别无二致
.gitignore 内容:
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static