2011-02-15 230 views
3

因此,我在我的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]# 

回答

0

嘗試以下操作:

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

3
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