简体   繁体   English

无法克隆我的Git存储库

[英]Can't clone my Git repository

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). 所以,我已经在我的liverserver上建立了我的第一个Git存储库,成功地将它克隆到了一个子域(我想用作登台服务器)。 Now I want to clone it to Github and to my local computer, but I cant. 现在我想将它克隆到Github和我的本地计算机,但我不能。 I followed the steps provided by github and tries all protocols for cloning. 我按照github提供的步骤,尝试所有克隆协议。 Below is just a small overview of what I have tried. 以下只是我尝试过的一个小概述。

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]# 
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 kasperso@kaspersorensen.com: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. 请注意,这不是使用ssh:// url模式。 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. 您没有向我们提供绝对路径,因此无法知道使用ssh:// url的正确URL是什么。 Additionally the www directory has been added to the url and the .git has been removed to match the path shown. 此外, www目录已添加到URL,并且.git已被删除以匹配显示的路径。


Edit: 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. 您收到此错误是因为git未安装到默认的$ PATH中。 It is probably installed somewhere like /usr/local/bin/git . 它可能安装在/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. 通过更改服务器上的内容来解决此问题的唯一方法是在与服务器交互的所有命令上使用-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 kasperso@kaspersorensen.com:www/wp-content 

Try the following: 请尝试以下方法:

git clone kasperso@kaspersorensen.com:www/wp-content

The your-repo.git way works when you copy the .git directory from within your project to another location and name it your-repo.git . 当您从您的项目中复制.git目录到另一个位置,并将其命名为您-repo.git你,repo.git方式工作。

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

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