eclipse pull提示the current branch is not configured for pull

来源:互联网 发布:热门的数据库研究方向 编辑:程序博客网 时间:2024/06/05 09:45

今天在将本地代码commit,然后pushgithub后,误删了本地代码文件,想通过pull同步github服务器与eclipse的代码,也是第一次进行pull操作,然而在eclipse中悬选择了项目后,team-pull,提示the current branch is not configured for pull,no value for key remote.origin.url found in configuration,记录下解决方法:

 

根据提示知道,config文件中缺少了remote.origin.url参数,则在eclipse-window-preferences,找到git-configuration-repository settings,repository选择当前项目,可查看到当前config的配置,此时一般只有一个core项参数,需要添加branchremote参数,按下图添加

 

[core]

    repositoryformatversion = 0

    filemode = false

    logallrefupdates = true

    [branch "master"]

        remote = master

        merge = refs/heads/master

    [remote "master"]

        url = git服务器上该项目的地址

        fetch = +refs/heads/*:refs/remotes/origin/*

注:以上标紫色的字段需保持一致,否则pull还是会提示找不到url,可以填originmaster或其他已建分支;url地址自定义,我填写的是自己项目在git服务器上的地址。

 

如果是出现提示:the current branch is not configured for pull,no value for key branch.modify.merge found in configuration.则是因为在config文件中没有创建branch,仅需要在config文件中添加branch参数:

[branch "xxx"]
remote = origin
merge = refs/heads/xxx

 

0 0