git 如何更改未注册的 VCS 根检测目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39472962/
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
How to change Unregistered VCS root detected directory
提问by Greg Marsh
When I create a new project in Android Studio on the Mac the VCS prompt does not include the sub-directory of the new project.
当我在 Mac 上的 Android Studio 中创建新项目时,VCS 提示不包含新项目的子目录。
For example, the unregistered VCS root detected prompt: The directory /Users/myname/AndroidStudioProjectsshould be /Users/myname/AndroidStudioProjects/NewProjectis under Git but is not registered in the Settings.
比如未注册的VCS root检测提示:目录/Users/myname/AndroidStudioProjects应该是/Users/myname/AndroidStudioProjects/NewProject在Git下但是在Settings里面没有注册。
Anyone knows the fix for this? As a work around I cancel this prompt, go into the VCS tab, import into VCS, and enter the correct directory.
任何人都知道解决这个问题?作为解决方法,我取消了这个提示,进入 VCS 选项卡,导入到 VCS,然后输入正确的目录。
回答by MrMAG
I just ran into the same issue.
我刚刚遇到了同样的问题。
Seems Jetbrain's IDE'S like IntelliJ-IDEA (or Android Studio) are only looking for descendant directories of the project-root to find further unregistered VCS roots.
似乎 Jetbrain 的 IDE 像 IntelliJ-IDEA(或 Android Studio)只是在寻找项目根目录的后代目录以进一步查找未注册的 VCS 根目录。
Adding the VCS roots manuallyto the Settings is really cumbersome.
手动将 VCS 根添加到设置中真的很麻烦。
AFAIK, there is no specific setting (indexing-level, automatic scan) to set or fix that, which changes the behavior. (at least not at the moment) But I have a little time saving workaround:
AFAIK,没有特定的设置(索引级别,自动扫描)来设置或修复它,这会改变行为。(至少目前不是)但我有一些节省时间的解决方法:
The VCS roots are always saved in your project-root/.idea/vcs.xml
file.
VCS 根目录始终保存在您的project-root/.idea/vcs.xml
文件中。
Workaround:
解决方法:
What I usually do is, I just copy (or clone) the sub-projects into a descendant directoryof my project-root (ie. /packages), which will prompt me the "unregistered VCS roots" balloon, where I then can hit "add roots"then.
Next I move the sub-projects into the desired destination. Hit Ctrl+Shift+N, and search for vcs.xml
(have to type it completely), which will get you where the added roots have been saved to. A last Find & Replaceand append the missing part of the destination directory.
我通常做的是,我只是将子项目复制(或克隆)到我的项目根目录(即 /packages)的后代目录中,这将提示我“未注册的 VCS 根”气球,然后我可以点击然后“添加根”。
接下来,我将子项目移动到所需的目的地。点击Ctrl+ Shift+N,然后搜索vcs.xml
(必须完全输入),这将使您找到添加的根保存到的位置。最后一个Find & Replace并附加目标目录的缺失部分。
I also keep a backup after I've edited the project-root/.idea/vcs.xml
file, for situations where I require the same sub-projects to be in my VCS roots, so I don't have to repeat this again.
在我编辑project-root/.idea/vcs.xml
文件后,我也会保留一个备份,用于需要相同子项目在我的 VCS 根目录中的情况,因此我不必再次重复此操作。
I hope Jetbrains will fix to also include sub directories, which goes deeper that one level of the project-root. This whould be useful.
我希望 Jetbrains 将修复还包括子目录,这会深入到项目根目录的一层。这应该有用。
回答by smooth_atonal_sound
You need to add a VCS Root to your project
你需要在你的项目中添加一个 VCS Root
https://www.jetbrains.com/help/phpstorm/2016.3/configuring-cvs-roots.html
https://www.jetbrains.com/help/phpstorm/2016.3/configuring-cvs-roots.html