参考
git重装,配置,vsCode 找不到存储库
【VSCode教程】3分钟配置GitHub、0命令行操作、超详细步骤!!
git分支管理
1、 在 VSCode 上初始化本地仓
在本地电脑上创建空文件夹。
进入文件夹下,终端运行
echo "# GIT" >> README.md
git init
git add README.md
git commit -m "first commit"
2、在 VSCode 上绑定远程仓
git remote add <自定义仓名> <路径:SSH或http>
git remote add origin https://github.com/Reykou/GitTest.git
新建的远程仓关联可在.git文件夹config文件中修改
3、拉取代码
git pull master main
master 是自定义的远程仓名(remote),随便取,代表github上的仓库
main为github上仓库下的分支,表示具体要拉哪一条分支
也可以在页面上拉取具体的分支
问题:拉代码时出现
The authenticity of host ‘github.com (192.30.253.113)’ can’t be established.
解决方法:本地少了 know_host文件,在刚刚那个位置输入yes就可以了,而不是回车
问题:fatal: Could not read from remote repository
解决方法:
生成添加SSH keys
https://fzy15116089232.blog.csdn.net/article/details/111537943
问题:
在github上填入SSH keys后提示:
Key is invalid. You must supply a key in OpenSSH public key format github
解决方法:
https://blog.csdn.net/weixin_45604257/article/details/106649576
4、推送代码
提交修改,将修改保存至本地仓库
终端执行:git push three master:bug
three是前文自定义的远程仓库名(为作区分由前文的master改为了three)
master是本地准备提交的分支
bug是自定义的远程分支名(任意)
如果github上没有该分支,则会新建一个
登录GitHub
点击New pull request
关于 pull request
将分支合并入主分支
完成后可删除自创建的分支
查询本地所有分支
git branch -a
查询remote
git remote -v