无法克隆我的 Git 存储库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5010475/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can't clone my Git repository
提问by caneclap
So, I have set up my first Git repository on my liverserver, succesfully cloned it to a subdomain (that I want to use as staging server). Now I want to clone it to Github and to my local computer, but I cant. I followed the steps provided by github and tries all protocols for cloning. Below is just a small overview of what I have tried.
所以,我在我的肝脏服务器上设置了我的第一个 Git 存储库,成功地将它克隆到一个子域(我想用作临时服务器)。现在我想将它克隆到 Github 和我的本地计算机,但我不能。我按照 github 提供的步骤并尝试了所有克隆协议。以下只是我尝试过的内容的一个小概述。
Kasper-Srensens-MacBook-Pro:wordpress Kasper$ ssh [email protected]
[email protected]'s password:
Last login: Tue Feb 15 15:35:13 2011 from 0x57368359.sdbnqu1.dynamic.dsl.tele.dk
[email protected] [~]# cd www/wp-content/
[email protected] [~/www/wp-content]# git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# backup-d2490/
# backup-db/
# blogs.dir/
# bte-wb/
# index.php
# sunrise.php
# uploads/
nothing added to commit but untracked files present (use "git add" to track)
[email protected] [~/www/wp-content]# logout
Connection to kaspersorensen.com closed.
Kasper-Srensens-MacBook-Pro:wordpress Kasper$ git clone git://kaspersorensen.com/wp-content.git
Cloning into wp-content...
kaspersorensen.com[0: 74.220.202.12]: errno=Operation timed out
fatal: unable to connect a socket (Operation timed out)
Kasper-Srensens-MacBook-Pro:wordpress Kasper$ git clone ssh://kaspersorensen.com/wp-content.git wp-content/
Cloning into wp-content...
[email protected]'s password:
Permission denied, please try again.
[email protected]'s password:
Permission denied, please try again.
[email protected]'s password:
Permission denied (publickey,password).
fatal: The remote end hung up unexpectedly
Kasper-Srensens-MacBook-Pro:wordpress Kasper$ No! I'm nor writing the password worng. It's crazy!
-bash: No!: command not found
Kasper-Srensens-MacBook-Pro:wordpress Kasper$ ssh [email protected]
[email protected]'s password:
Last login: Tue Feb 15 15:40:27 2011 from 0x57368359.sdbnqu1.dynamic.dsl.tele.dk
[email protected] [~]# cd www/wp-content/
[email protected] [~/www/wp-content]# git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# backup-d2490/
# backup-db/
# blogs.dir/
# bte-wb/
# index.php
# sunrise.php
# uploads/
nothing added to commit but untracked files present (use "git add" to track)
[email protected] [~/www/wp-content]# git remote add origin [email protected]:kasperbs/wp-content.git
fatal: remote origin already exists.
[email protected] [~/www/wp-content]#
回答by Arrowmaster
git clone git://kaspersorensen.com/wp-content.git
Is failing because you probably don't have git-daemon running.
失败是因为您可能没有运行 git-daemon。
git clone ssh://kaspersorensen.com/wp-content.git wp-content/
Is failing because your local username and the remote username are different so you need to add the remote username to the url.
失败是因为您的本地用户名和远程用户名不同,因此您需要将远程用户名添加到 url。
git clone [email protected]:www/wp-content
Is the only possible command that will work based on the information you've provided.
是唯一可以根据您提供的信息工作的命令。
Note that this is not using the ssh:// url pattern. You did not provide us with the absolute path so it is impossible to know what the correct url would be using the ssh:// url. Additionally the wwwdirectory has been added to the url and the .githas been removed to match the path shown.
请注意,这不是使用 ssh:// url 模式。您没有向我们提供绝对路径,因此无法知道使用 ssh:// url 的正确 url 是什么。此外,www目录已添加到 url 并且.git已被删除以匹配显示的路径。
编辑:
bash: git-upload-pack: command not found fatal: The remote end hung up unexpectedly
bash: git-upload-pack: command not found fatal: The remote end hung up unexpectedly
You are getting this error because git is not installed into the default $PATH. It is probably installed somewhere like /usr/local/bin/git
. The only way to fix this with changing things on the server is to use the -u
option on all commands that interact with the server.
您收到此错误是因为 git 未安装到默认的 $PATH 中。它可能安装在类似/usr/local/bin/git
. 通过更改服务器上的内容来解决此问题的唯一方法是在与服务器-u
交互的所有命令上使用该选项。
On the server run which git-upload-pack
then use the location from that in the following command.
在服务器上运行,which git-upload-pack
然后使用以下命令中的位置。
git clone -u /path/to/git-upload-pack [email protected]:www/wp-content
回答by rausch
Try the following:
请尝试以下操作:
git clone [email protected]:www/wp-content
The your-repo.gitway works when you copy the .gitdirectory from within your project to another location and name it your-repo.git.
在您的-repo.git当您复制工作的方式。git的从你的项目中的目录复制到另一个位置,并将其命名为您-repo.git。