git 为什么我会得到一个“目标路径”。已存在”尝试从我的网络服务器进行克隆时出现错误?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25591486/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why am I getting a "destination path '.' already exists" error when trying clone from my webfaction server?
提问by user2492364
I'm trying to use git clone
to download the codes from my webfaction server
我正在尝试git clone
从我的网络服务器下载代码
$ cd ../webapps/nameofwebapp/
$ git clone [email protected]:github-username/github-repo.git ./
AND there is error :
并且有错误:
fatal: destination path '.' already exists and is not an empty directory.
I use ls and there are something under the nameofwebapp
我使用 ls 并且下面有一些东西 nameofwebapp
auth git.cgi gitweb.cgi repos static
I want to ask where to use git clone
Do I need to make a new directory??
请问在哪里使用git clone
需要新建目录吗??
采纳答案by VonC
Simply:
简单地:
git clone [email protected]:github-username/github-repo.git
That will create a new folder github-repo
in ../webapps/nameofwebapp/
.
这将github-repo
在../webapps/nameofwebapp/
.
In your case:
在你的情况下:
cd ../webapps/nameofwebapp/
git clone [email protected]:github-username/github-repo.git -b develop ./
If you already did the clone:
如果您已经进行了克隆:
cd github-repo
git checkout -b develop origin/develop
回答by littlek.shaojian
Maybe you have a same name git project directory in current path, git clone command will create a new directory and will crash if there is a same name directory.
可能你当前路径下有同名的 git 项目目录,git clone 命令会新建一个目录,如果有同名目录会崩溃。
回答by Hedego
The issue for me was related to SSH keys. When I set the key, it worked fine.
我的问题与 SSH 密钥有关。当我设置密钥时,它工作正常。