将现有项目添加到 github 并获得“* [new branch] master -> master”
Added an existing project to github and got a "* [new branch] master -> master"
正在按照 here to add an existing project 到 github 的说明进行操作。我做了 git push origin master
并得到:* [new branch] master -> master
.
我不记得以前见过这个。这正常吗?
编辑 1:
ray@rays8350 /cygdrive/d/ray/allEclipseProjects/eclipseworkspaces
$ git remote show origin
* remote origin
Fetch URL: https://github.com/rtayek/eclipseworkspaces.git
Push URL: https://github.com/rtayek/eclipseworkspaces.git
HEAD branch: master
Remote branch:
master tracked
Local ref configured for 'git push':
master pushes to master (up to date)
ray@rays8350 /cygdrive/d/ray/allEclipseProjects/eclipseworkspaces
$ git remote -vv
origin https://github.com/rtayek/eclipseworkspaces.git (fetch)
origin https://github.com/rtayek/eclipseworkspaces.git (push)
ray@rays8350 /cygdrive/d/ray/allEclipseProjects/eclipseworkspaces
$ git branch -vv
* master 8112d8f added license.
ray@rays8350 /cygdrive/d/ray/allEclipseProjects/eclipseworkspaces
$ git branch -a
* master
remotes/origin/master
ray@rays8350 /cygdrive/d/ray/allEclipseProjects/eclipseworkspaces
$
是的,很正常。
更准确地说,当 other Git 存储库(在本例中为 GitHub 上的存储库)没有您刚刚告诉它创建的分支名称。它现在已经成为分支名称。由于您将 GitHub 存储库创建为 完全空的 存储库,其中没有提交,也没有分支名称,因此该存储库不可能具有您告诉它的分支名称使用。所以它不得不将它创建为一个新的分支名称。
请注意,在任何 Git 存储库中,Git 本身必须遵守严格的约束:该存储库中的每个分支名称必须包含某个有效的现有的(单个)哈希 ID犯罪。这意味着新的空存储库 不能 有任何分支名称,因为它没有提交。出于这个原因,GitHub 提议创建每个新的存储库,其中包含一个初始提交,该初始提交包含一个 README
文件、一个 LICENSE
文件,等等。 The instructions you linked 告诉您避免这种情况,这样第一次提交就不会妨碍您。
通过避免初始提交,您可以避免这种令人头疼的事情(处理初始提交),而这种头疼会让您感到另一种头疼:没有分支的存储库。但是说明继续告诉你如何让那个空的存储库变得非空,这样它现在就可以有分支名称了。
正在按照 here to add an existing project 到 github 的说明进行操作。我做了 git push origin master
并得到:* [new branch] master -> master
.
我不记得以前见过这个。这正常吗?
编辑 1:
ray@rays8350 /cygdrive/d/ray/allEclipseProjects/eclipseworkspaces
$ git remote show origin
* remote origin
Fetch URL: https://github.com/rtayek/eclipseworkspaces.git
Push URL: https://github.com/rtayek/eclipseworkspaces.git
HEAD branch: master
Remote branch:
master tracked
Local ref configured for 'git push':
master pushes to master (up to date)
ray@rays8350 /cygdrive/d/ray/allEclipseProjects/eclipseworkspaces
$ git remote -vv
origin https://github.com/rtayek/eclipseworkspaces.git (fetch)
origin https://github.com/rtayek/eclipseworkspaces.git (push)
ray@rays8350 /cygdrive/d/ray/allEclipseProjects/eclipseworkspaces
$ git branch -vv
* master 8112d8f added license.
ray@rays8350 /cygdrive/d/ray/allEclipseProjects/eclipseworkspaces
$ git branch -a
* master
remotes/origin/master
ray@rays8350 /cygdrive/d/ray/allEclipseProjects/eclipseworkspaces
$
是的,很正常。
更准确地说,当 other Git 存储库(在本例中为 GitHub 上的存储库)没有您刚刚告诉它创建的分支名称。它现在已经成为分支名称。由于您将 GitHub 存储库创建为 完全空的 存储库,其中没有提交,也没有分支名称,因此该存储库不可能具有您告诉它的分支名称使用。所以它不得不将它创建为一个新的分支名称。
请注意,在任何 Git 存储库中,Git 本身必须遵守严格的约束:该存储库中的每个分支名称必须包含某个有效的现有的(单个)哈希 ID犯罪。这意味着新的空存储库 不能 有任何分支名称,因为它没有提交。出于这个原因,GitHub 提议创建每个新的存储库,其中包含一个初始提交,该初始提交包含一个 README
文件、一个 LICENSE
文件,等等。 The instructions you linked 告诉您避免这种情况,这样第一次提交就不会妨碍您。
通过避免初始提交,您可以避免这种令人头疼的事情(处理初始提交),而这种头疼会让您感到另一种头疼:没有分支的存储库。但是说明继续告诉你如何让那个空的存储库变得非空,这样它现在就可以有分支名称了。