“remote”是什么意思?当克隆位于中央位置的存储库时,我们不是正在创建其远程版本吗?
当我执行命令时
$ git remote
我明白了原点的含义。这是什么意思?
当我执行
$ git branch -r
我获取了origin/master。那现在这是什么意思?
“remote”是什么意思?当克隆位于中央位置的存储库时,我们不是正在创建其远程版本吗?
当我执行命令时
$ git remote
我明白了原点的含义。这是什么意思?
当我执行
$ git branch -r
我获取了origin/master。那现在这是什么意思?
我在这里找到了一个很好的答案(链接):
如你所知,git是一种分布式版本控制系统。大多数操作都在本地完成。为了与外界通信,git使用称为远程的内容。这些是除了你本地磁盘上的仓库之外的其他仓库,你可以将自己的更改推送到其中(以便其他人可以看到它们),或者从中拉取(以便您可以获取其他人的更改)。命令
git remote add origin git@github.com:peter/first_app.git
创建了一个名为origin的新远程,位于git@github.com:peter/first_app.git
。一旦你这样做了,在你的推送命令中,你可以推送到origin而不是输入整个URL。
我建议阅读整个回答。
remote
在Git中基本上是一个书签,用于不同的仓库,您可能希望从中拉取或推送代码。
书签仓库可以在您的本地计算机中的不同文件夹中,也可以在远程服务器上,甚至可以是仓库本身(我还没有尝试过这个功能),但最简单的比喻是一个书签。
仓库甚至不必是您的仓库的版本,它可能是完全不相关的仓库。
The command "git push" sends the committed changes in your local repository to a remote repository.
$ git remote
"git remote", what does "origin" mean?
The "git remote" command lists the shortnames of each remote handle you've specified. If you have cloned your repository, you should at least see "origin" - this is the default name that Git gives to the server you cloned from.
Executing "git remote -v" will show you the shortname and corresponding URL of the remote repository.
$ git branch -r
我得到了origin/master。那么这是什么意思呢?
origin 是 Git 为你创建的远程仓库名称,用于引用远程代码库;master 则是指向最后提交的默认分支。 因此,“git branch -r” 将列出远程(origin) 的分支(master)。
参考资料:
git push origin master
来根据本地提交进行更新GitHub的原因。 - Šime Vidas