赞
踩
个人感觉VSCode的git没有IDEA的好用,翻来覆去搞了好多遍才推送上去
git remote add origin [url地址]
连接好以后可以再用代码检查一下,有内容显示的话应该没什么问题
git remote -v
git branch --set-upstream-to=origin/远程分支名 本地分支名
运行以后会有报错
PS D:\tools\github\backstage-brain> git branch --set-upstream-to=origin/master main
fatal: the requested upstream branch 'origin/master' does not exist
hint:
hint: If you are planning on basing your work on an upstream
hint: branch that already exists at the remote, you may need to
hint: run "git fetch" to retrieve it.
hint:
hint: If you are planning to push out a new local branch that
hint: will track its remote counterpart, you may want to use
hint: "git push -u" to set the upstream config as you push.
hint: Disable this message with "git config advice.setUpstreamFailure false"
这个时候就还需要执行一条指令
git config advice.setUpstreamFailure false
重新执行,发现又报错了,fatal: the requested upstream branch 'origin/master' does not exist,哭晕,查了很久资料,原来还得执行一步
git pull origin master --allow-unrelated-histories
这条指令是把仓库里的代码拉下来,空白仓库当然啥也没有,果断选择拉下来,不用担心文件覆盖的问题
再次执行连接的指令,终于连接成功了,之后正常使用就可以了。
总之这比IDEA麻烦太多了,各种小问题层出不穷,而且界面也不是很清晰明了,后面再慢慢摸索吧
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。