GIT常见问题

守給你的承諾、 提交于 2020-01-24 04:31:39

问题

You asked to pull from the remote 'origin', but did not specify a branch. Because this is not the default configured remote

for your current branch, you must specify a branch on the command line.

##增加一个远程分支,并且将该远程分支命名为origin
git remote add origin https://github.com/XXX(username)/YYYY(projectname).git
##设置本地master分支默认对应的远程分支是origin下的master分支
git branch --set-upstream-to=origin/master master 

一个分支的upstream,其实就是与远程分支做关联,告诉git,默认此分支为推送及拉取的远程分支的信息。

例如我的一个例子上的配置

[remote "ddjf"]
        url = https://gitee.com/anna-prince/ddjf.git
        fetch = +refs/heads/*:refs/remotes/ddjf/*
[branch "master"]
        remote = ddjf
        merge = refs/heads/master
        rebase = false
[branch "jf20200119"]
        remote = ddjf
        merge = refs/heads/jifen20200119
        rebase = false

本地有两个分支,master和jf20200119,对应的远程分支ddjf

 

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!