简体   繁体   English

Git存储库 - 如何克隆/home/user/.git

[英]Git repository - how do I clone /home/user/.git

I've got a website on a VPS and I'd like to create an offline clone using Git. 我有一个关于VPS的网站,我想用Git创建一个离线克隆。

So what I did on my VPS: 那么我在我的VPS上做了什么:

git init
git add .
git commit -m "comment"

Which created a .git folder. 其中创建了一个.git文件夹。 I am not sure now how I am supposed to continue in order to clone the git repository to my local machine. 我现在不确定我应该如何继续将git存储库克隆到我的本地机器。

I've tried using: git clone ssh://user@IP/home/user/.git but I get the following messages: 我尝试过使用: git clone ssh://user@IP/home/user/.git但我收到以下消息:

fatal: '/home/user/.git' does not appear to be a git repository 
fatal: Could not read from remote repository.

Can you please let me know what I am missing here? 你能告诉我这里缺少什么吗?

you should just "ignore" the existence of the .git directory: 你应该“忽略”.git目录的存在:

git clone ssh://user@IP:/home/user/

should do the trick (if ssh user@IP works of course). 应该做的伎俩(如果ssh user@IP工作当然)。

NOTE: not sure it's a good idea to make your whole "user" directory a git repository. 注意:不确定将整个“用户”目录设置为git存储库是个好主意。 using a subdirectory is probably a good idea. 使用子目录可能是个好主意。

EDIT: in this case file permissions were also an issue in copying files from a linux pc to a windows pc... 编辑:在这种情况下,文件权限也是将文件从Linux PC复制到Windows PC的问题...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM