简体   繁体   中英

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). 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.

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 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.


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. 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 www directory has been added to the url and the .git has been removed to match the path shown.


Edit: 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.

On the server run which git-upload-pack then use the location from that in the following command.

 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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