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.
我认为我在后一种情况下遗漏了一些东西 - 有谁知道这里有什么(不)?我正在使用最新的git版本,显然没有很好地使用它。
3 个解决方案
#1
13
If you cd into your repository directory and then open up your .git/config file in an editor.
如果您进入存储库目录,然后在编辑器中打开.git / config文件。
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.
这几乎只是一个别名,因此默认情况下git知道从原始主数据中提取。
#2
12
Or if you prefer, you can do the same thing Brian Gianforcaro proposed from the command line:
或者,如果您愿意,可以使用命令行中的Brian Gianforcaro提出的相同操作:
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
#3
6
Also, to avoid having to do git push master
, you can specify what branches to push in your Git config file, like so:
另外,为了避免必须执行git push master,您可以在Git配置文件中指定要推送的分支,如下所示:
[remote "origin"]
...
push = master
#1
13
If you cd into your repository directory and then open up your .git/config file in an editor.
如果您进入存储库目录,然后在编辑器中打开.git / config文件。
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.
这几乎只是一个别名,因此默认情况下git知道从原始主数据中提取。
#2
12
Or if you prefer, you can do the same thing Brian Gianforcaro proposed from the command line:
或者,如果您愿意,可以使用命令行中的Brian Gianforcaro提出的相同操作:
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
#3
6
Also, to avoid having to do git push master
, you can specify what branches to push in your Git config file, like so:
另外,为了避免必须执行git push master,您可以在Git配置文件中指定要推送的分支,如下所示:
[remote "origin"]
...
push = master