git 从github克隆时更改文件夹的名称?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8570636/
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
Change name of folder when cloning from github?
提问by Leahcim
when I clone something from Github, it creates a folder with the same name as the app on my computer. Is there a way to change the name.
当我从 Github 克隆一些东西时,它会创建一个与我电脑上的应用程序同名的文件夹。有没有办法改名字。
For example, doing this clone creates a long "sign-in-with-twitter" folder
例如,执行此克隆操作会创建一个很长的“sign-in-with-twitter”文件夹
git clone https://github.com/sferik/sign-in-with-twitter.git
I know I can rename the folder after, but I'm wondering if there's a way to rename it as it comes in by adding an option on the end of the statement. For example
我知道我可以在之后重命名文件夹,但我想知道是否有办法通过在语句末尾添加一个选项来重命名它。例如
git clone https://github.com/sferik/sign-in-with-twitter.git as 'signin'
the problem is that I'm cloning some apps multiple times in order to tweak some of the settings to get it to work, and if there's a problem, I delete the folder but I'm worried that some of the gems remain installed even though I've deleted the folder
问题是我多次克隆一些应用程序以调整一些设置以使其正常工作,如果出现问题,我会删除该文件夹,但我担心即使某些 gem 仍然安装我删除了文件夹
回答by MLN
You can do this.
你可以这样做。
git clone https://github.com/sferik/sign-in-with-twitter.git signin
回答by Michael Leiss
git clone <Repo> <DestinationDirectory>
Clone the repository located at Repo into the folder called DestinationDirectory on the local machine.
将位于 Repo 的存储库克隆到本地计算机上名为 DestinationDirectory 的文件夹中。
回答by Mohideen bin Mohammed
Simply clone like this,
像这样简单地克隆,
git clone https://github.com/user/userApp.git name_you_want
this command will clone your app in the name what you specified after that - clone http command
此命令将以您之后指定的名称克隆您的应用程序 - clone http 命令
回答by Jesus Erwin Suarez
git clone https://github.com/user/sign-in-with-twitter.git it-could-be-like-this
回答by Josh
Arrived here because my source repo had %20
in it which was creating local folders with %20
in them when using simplistic git clone <url>
.
到达这里是因为我的源代码库中有%20
在%20
使用 simplistic 时在其中创建本地文件夹git clone <url>
。
Easy solution:
简单的解决方案:
git clone https://teamname.visualstudio.com/Project%20Name/_git/Repo%20Name "Repo Name"
git clone https://teamname.visualstudio.com/Project%20Name/_git/Repo%20Name "Repo Name"
回答by gprathour
In case you want to clone a specific branch only, then,
如果你只想克隆一个特定的分支,那么,
git clone -b <branch-name> <repo-url> <destination-folder-name>
for example,
例如,
git clone -b dev https://github.com/sferik/sign-in-with-twitter.git signin
回答by Bhawna Jain
Here is one more answer from @Marged in comments
这是@Marged 在评论中的另一个答案
- Create a folder with the name you want
Run the command below from the folder you created
git clone <path to your online repo> .
- 用你想要的名字创建一个文件夹
从您创建的文件夹运行以下命令
git clone <path to your online repo> .