所以,我已经在我的liverserver上建立了我的第一个Git存储库,成功地将它克隆到了一个子域(我想用作登台服务器)。现在我想将它克隆到Github和我的本地计算机,但我不能。我按照github提供的步骤,尝试所有克隆协议。以下是我尝试过的一个小概述。
Kasper-Srensens-MacBook-Pro:wordpress Kasper$ ssh kasperso@kaspersorensen.com
kasperso@kaspersorensen.com's password:
Last login: Tue Feb 15 15:35:13 2011 from 0x57368359.sdbnqu1.dynamic.dsl.tele.dk
kasperso@kaspersorensen.com [~]# cd www/wp-content/
kasperso@kaspersorensen.com [~/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)
kasperso@kaspersorensen.com [~/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...
Kasper@kaspersorensen.com's password:
Permission denied, please try again.
Kasper@kaspersorensen.com's password:
Permission denied, please try again.
Kasper@kaspersorensen.com'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 kasperso@kaspersorensen.com
kasperso@kaspersorensen.com's password:
Last login: Tue Feb 15 15:40:27 2011 from 0x57368359.sdbnqu1.dynamic.dsl.tele.dk
kasperso@kaspersorensen.com [~]# cd www/wp-content/
kasperso@kaspersorensen.com [~/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)
kasperso@kaspersorensen.com [~/www/wp-content]# git remote add origin git@github.com:kasperbs/wp-content.git
fatal: remote origin already exists.
kasperso@kaspersorensen.com [~/www/wp-content]#
答案 0 :(得分:3)
git clone git://kaspersorensen.com/wp-content.git
失败是因为您可能没有运行git-daemon。
git clone ssh://kaspersorensen.com/wp-content.git wp-content/
失败是因为您的本地用户名和远程用户名不同,因此您需要将远程用户名添加到网址。
git clone kasperso@kaspersorensen.com:www/wp-content
唯一可能的命令将根据您提供的信息起作用。
请注意,这不是使用ssh:// url模式。您没有向我们提供绝对路径,因此无法知道使用ssh:// url的正确URL是什么。此外, www 目录已添加到网址中, .git 已被删除,以匹配显示的路径。
<小时/> 修改: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 kasperso@kaspersorensen.com:www/wp-content
答案 1 :(得分:0)
尝试以下方法:
git clone kasperso@kaspersorensen.com:www/wp-content
your-repo.git 方式将项目中的 .git 目录复制到其他位置,并将其命名为 your-repo.git