用于创建 git 远程存储库的类似于 Mercurial 的方法
Mercurial like method for creating git remote repository
当我使用 Mercurial 时,创建远程存储库是一个命令行:
hg clone local remote
远程是可以通过 ssh 访问的东西。例如:
hg clone /path/to/local/repo.hg ssh://host.name/path/to/new/clone.hg
我不知道它是否是 Mercurial 中的一个功能,或者我们已经安装了一些东西来实现它。
有什么方法可以用 git 做到这一点吗?或者安装一些东西,让我可以像使用 Mercurial 一样做同样的事情?
注意
我的问题不是'How to clone a remote repository?'
不,你不能用一个命令做到这一点,你也不能单独使用 Git 来做到这一点。
你掷出这样的东西:
初始化服务器上的存储库:
ssh user@server git init --bare /path/to/the/new/repo
将您的本地存储库推送到那里:
git push --all --tags ssh://user@server/path/to/the/new/repo
如果您打算之后使用该新的远程存储库 (push/fetch),将其添加为命名的远程存储库是有意义的,因此您的第 2 步变为:
git remote add foo ssh://user@server/path/to/the/new/repo
git push --all --tags foo
当我使用 Mercurial 时,创建远程存储库是一个命令行:
hg clone local remote
远程是可以通过 ssh 访问的东西。例如:
hg clone /path/to/local/repo.hg ssh://host.name/path/to/new/clone.hg
我不知道它是否是 Mercurial 中的一个功能,或者我们已经安装了一些东西来实现它。
有什么方法可以用 git 做到这一点吗?或者安装一些东西,让我可以像使用 Mercurial 一样做同样的事情?
注意
我的问题不是'How to clone a remote repository?'
不,你不能用一个命令做到这一点,你也不能单独使用 Git 来做到这一点。
你掷出这样的东西:
初始化服务器上的存储库:
ssh user@server git init --bare /path/to/the/new/repo
将您的本地存储库推送到那里:
git push --all --tags ssh://user@server/path/to/the/new/repo
如果您打算之后使用该新的远程存储库 (push/fetch),将其添加为命名的远程存储库是有意义的,因此您的第 2 步变为:
git remote add foo ssh://user@server/path/to/the/new/repo
git push --all --tags foo