无法克隆我的Git存储库

问题描述:

因此,我在我的liverserver上设置了我的第一个Git存储库,并将其成功克隆到一个子域(我想用作登台服务器)。现在我想克隆它到Github和我的本地计算机,但我不能。我遵循github提供的步骤并尝试克隆所有协议。以下只是我尝试过的一个小概述。无法克隆我的Git存储库

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]# 

尝试以下操作:

git clone [email protected]:www/wp-content 

您-repo.git的工作方式,当你从你的项目中复制git的目录到另一个位置,并将其命名为你的 - repo.git

+2

这不完全是制作裸仓库的最佳方式。你应该使用`git clone --bare`。 (有几个配置设置在裸回购版中有所不同) – Cascabel 2011-02-15 23:09:43

+0

没有工作: `Kasper-Srensens-MacBook-Pro:wordpress Kasper $ git clone [email protected]:www/wp-content 克隆到wp -content ... [email protected]'s密码: 庆典:混帐上载包装:命令未找到 致命:远程端挂机意外 卡斯帕 - Srensens-的MacBook-PRO:WordPress的卡斯帕$` – 2011-02-16 08:42:03

git clone git://kaspersorensen.com/wp-content.git 

失败,因为您可能没有运行git-daemon。

git clone ssh://kaspersorensen.com/wp-content.git wp-content/ 

失败,因为这样你就需要在远程用户名添加到URL本地用户名和远程用户名是不同的。


git clone [email protected]:www/wp-content 

是,将工作根据您所提供的信息的唯一可能的命令。

请注意,这不是使用ssh:// url模式。您没有向我们提供绝对路径,因此无法知道使用ssh:// url的正确url。此外,www目录已被添加到url,.gg已被删除以匹配显示的路径。


编辑: bash: git-upload-pack: command not found fatal: The remote end hung up unexpectedly

因为Git是没有安装到默认的$ PATH您收到此错误。它可能安装在某个地方,如/usr/local/bin/git。在服务器上更改内容的唯一方法是在所有与服务器交互的命令上使用-u选项。

在服务器上运行which git-upload-pack然后使用以下命令中的位置。

git clone -u /path/to/git-upload-pack [email protected]:www/wp-content