Git:什么是 project.git 以及如何通过 SSH 从拥有的域克隆它
Git: what is project.git and how to clone it via SSH from an owned domain
这很愚蠢(问题或git系统或git文档-我还没有决定)。
我可以通过 ssh 访问客户端的服务器。有一个网站 domain.com
,还有 git
个存储库,它们在 /var/www/html
下。在 git
配置文件中没有遥控器,但它们应该在那里吗? Git自己安装了,我可以列出历史记录。
主题是问题:在本地电脑上,我如何从该存储库中推送和拉取?还是我误会了什么?
您似乎有一个远程存储库,您希望在本地机器上使用它。
克隆
您需要在您的本地计算机上复制该存储库,否则您将如何使用它,对吗?让我们看看文档:
The SSH Protocol
A common transport protocol for Git when self-hosting
is over SSH. This is because SSH access to servers is already set up
in most places — and if it isn’t, it’s easy to do. SSH is also an
authenticated network protocol and, because it’s ubiquitous, it’s
generally easy to set up and use.
To clone a Git repository over SSH, you can specify an ssh://
URL like
this:
$ git clone ssh://[user@]server/project.git
Or you can use the shorter
scp-like syntax for the SSH protocol:
$ git clone [user@]server:project.git
In both cases above, if you
don’t specify the optional username, Git assumes the user you’re
currently logged in as. [source]
在你的情况下,命令应该是 ssh://root@domain.com/var/www/html/.git
1,因为我们能够在评论中敲定。
这将在本地克隆该存储库,并将您的本地克隆设置为指向该存储库作为远程存储库。
Man, the point is that I have already read that git doc and all related stuff. There is everywhere project.git
at the end of command, which is repo name I guess.
现在我看到了困惑。通常,本地的 git
回购被克隆为工作副本。工作副本有一个根目录和一个隐藏的 .git
文件夹。然而,this is not always the case, as you may create a repository as bare。将裸存储库初始化为 repo.git
是一种约定(据我所知不是强制性的)。裸存储库不拥有隐藏的 .git
文件夹,因此,“.git”附加到根文件夹名称。这就是为什么您经常在 git 文档中看到 project.git
。
In git
config file there are no remotes, but should they be there?
在遥控器上,可能没有,应该没有。这不是一般规则(相反),但根据您的描述应该是最佳答案。在你的本地克隆上,相反,应该有一个。
1) 这告诉我们两件事:如果那个位置 是 一个文件夹 .git
,那么您的根文件夹是 html
并且其中的所有内容都在版本控制之下。因此,您的遥控器被设置为工作副本。如果不是这种情况,因为您说您可以 运行 远程中的一些 git 命令,您可能想要 check if the remote is bare 并使用这些工具对该 repo 的根目录进行故障排除。
这很愚蠢(问题或git系统或git文档-我还没有决定)。
我可以通过 ssh 访问客户端的服务器。有一个网站 domain.com
,还有 git
个存储库,它们在 /var/www/html
下。在 git
配置文件中没有遥控器,但它们应该在那里吗? Git自己安装了,我可以列出历史记录。
主题是问题:在本地电脑上,我如何从该存储库中推送和拉取?还是我误会了什么?
您似乎有一个远程存储库,您希望在本地机器上使用它。
克隆
您需要在您的本地计算机上复制该存储库,否则您将如何使用它,对吗?让我们看看文档:
The SSH Protocol
A common transport protocol for Git when self-hosting is over SSH. This is because SSH access to servers is already set up in most places — and if it isn’t, it’s easy to do. SSH is also an authenticated network protocol and, because it’s ubiquitous, it’s generally easy to set up and use.
To clone a Git repository over SSH, you can specify an
ssh://
URL like this:$ git clone ssh://[user@]server/project.git
Or you can use the shorter scp-like syntax for the SSH protocol:
$ git clone [user@]server:project.git
In both cases above, if you don’t specify the optional username, Git assumes the user you’re currently logged in as. [source]
在你的情况下,命令应该是 ssh://root@domain.com/var/www/html/.git
1,因为我们能够在评论中敲定。
这将在本地克隆该存储库,并将您的本地克隆设置为指向该存储库作为远程存储库。
Man, the point is that I have already read that git doc and all related stuff. There is everywhere
project.git
at the end of command, which is repo name I guess.
现在我看到了困惑。通常,本地的 git
回购被克隆为工作副本。工作副本有一个根目录和一个隐藏的 .git
文件夹。然而,this is not always the case, as you may create a repository as bare。将裸存储库初始化为 repo.git
是一种约定(据我所知不是强制性的)。裸存储库不拥有隐藏的 .git
文件夹,因此,“.git”附加到根文件夹名称。这就是为什么您经常在 git 文档中看到 project.git
。
In
git
config file there are no remotes, but should they be there?
在遥控器上,可能没有,应该没有。这不是一般规则(相反),但根据您的描述应该是最佳答案。在你的本地克隆上,相反,应该有一个。
1) 这告诉我们两件事:如果那个位置 是 一个文件夹 .git
,那么您的根文件夹是 html
并且其中的所有内容都在版本控制之下。因此,您的遥控器被设置为工作副本。如果不是这种情况,因为您说您可以 运行 远程中的一些 git 命令,您可能想要 check if the remote is bare 并使用这些工具对该 repo 的根目录进行故障排除。