How do I fix missing git remote details?

Some repository clones I have allow me to do this:

% git pull
% git push

But other repositories require me to type:

% git pull origin master
% git push origin master

I think I am missing something in the latter case - does anyone know what is (not) going on here? I am using the latest git version, just obviously not using it well.


If you cd into your repository directory and then open up your .git/config file in an editor.

Append this to the end of the file:

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

This is pretty much just an alias so git knows by default to pull from origin master.


或者,如果你愿意,你可以做同样的事情Brian Gianforcaro从命令行提出的建议:

git config branch.master.remote origin
git config branch.master.merge  refs/heads/master

此外,为了避免必须执行git push master ,您可以指定在Git配置文件中推送哪些分支,如下所示:

[remote "origin"]
        ...
        push = master
链接地址: http://www.djcxy.com/p/4560.html

上一篇: 使用dyn.load在R x64中加载已编译c代码的问题

下一篇: 如何修复缺少的git远程详细信息?