简体   繁体   English

如何更改未注册的 VCS 根检测目录

[英]How to change Unregistered VCS root detected directory

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/AndroidStudioProjects should be /Users/myname/AndroidStudioProjects/NewProject is 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,然后输入正确的目录。

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 manually to 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. AFAIK,没有特定的设置(索引级别,自动扫描)来设置或修复它,这会改变行为。 (at least not at the moment) But I have a little time saving workaround: (至少目前不是)但我有一些节省时间的解决方法:

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 directory of my project-root (ie. /packages) , which will prompt me the "unregistered VCS roots" balloon, where I then can hit "add roots" then.我通常做的是,我只是将子项目复制(或克隆)到我的项目根目录(即 /packages)的后代目录中,这将提示我“未注册的 VCS 根”气球,然后我可以点击然后“添加根”
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.按 Ctrl + Shift + N ,然后搜索vcs.xml (必须完全输入),这将让您找到添加的根目录的保存位置。 A last Find & Replace and append the missing part of the destination directory .最后一个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.我希望 Jetbrains 将修复还包括子目录,这会深入到项目根目录的一层。 This whould be useful.这应该有用。

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

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