Git 同步到新库/更换仓库

进行git初始化
git init
将本地代码添加到仓库
git add ./注意有空格
git commit -m “上传仓库时的说明”
关联上远程仓库
git remote add origin https://github.com/DavidCuii/react-ts-app.git
最后将你的代码上传到Git库
git push -u origin master

更换仓库
第一: 查看远程库的信息: git remote -v
第二: 删除现有的远程仓库: git remote rm origin
第三: 建立新的远程仓库地址: git remote add origin + 远程仓库地址

1
2
3
4
5
6
7
8
9
<code-pre class="code-pre" id="pre-RYRJnC"><code-line class="line-numbers-rows"></code-line>There is no tracking information for the current branch.
<code-line class="line-numbers-rows"></code-line>Please specify which branch you want to merge with.
<code-line class="line-numbers-rows"></code-line>See git-pull(1) for details.
<code-line class="line-numbers-rows"></code-line>
<code-line class="line-numbers-rows"></code-line>    git pull <remote> <branch>
<code-line class="line-numbers-rows"></code-line>
<code-line class="line-numbers-rows"></code-line>If you wish to set tracking information for this branch you can do so with:
<code-line class="line-numbers-rows"></code-line>
<code-line class="line-numbers-rows"></code-line>    git branch --set-upstream-to=origin/<branch> master</code-pre>

当出现这个问题时,是因为本地分支和远程分支没有建立联系,可以先指定本地master到远程的master,然后再去pull

1
<code-pre class="code-pre" id="pre-DzKpxN"><code-line class="line-numbers-rows"></code-line>git branch --set-upstream-to=origin/master master<br>git pull</code-pre>

  


__EOF__

本文作者userName
本文链接https://www.cnblogs.com/wencaiguagua/p/17391016.html
关于博主:评论和私信会在第一时间回复。或者直接私信我。
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角推荐一下。您的鼓励是博主的最大动力!
posted @   文采呱呱  阅读(53)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
点击右上角即可分享
微信分享提示