简体   繁体   English

如何阻止XCode 4修改本地Git存储库?

[英]How do I stop XCode 4 from modifying a local Git repository?

I have a Git repository, which for my own reasons I want to manage outside of XCode 4. Really what I want is XCode to just leave my repository alone. 我有一个Git存储库,出于我自己的原因,我想在XCode 4之外进行管理。我真正想要的是XCode只留下我的存储库。 However, I've noticed that XCode will add new projects to the repository if they're saved inside the repository. 但是,我注意到如果将新项目保存在存储库中,XCode会将新项目添加到存储库中。

For example, suppose I start out with a plain ol' repo: 例如,假设我从一个简单的回购开始:

mkdir gittest; cd gittest
git init; touch a; git add a; git commit

I fire up XCode and create a new project. 我启动XCode并创建一个新项目。 NOTE: I do not have the "Create local git repository for this project" checkbox checked. 注意:我没有选中“为此项目创建本地git存储库”复选框。 For the destination dir, I save it to the directory gittest . 对于目标目录,我将其保存到目录gittest

git status reveals: git status显示:

# On branch master
# Changes to be committed:
#   (use "git reset HEAD ..." to unstage)
#
#   new file:   gittest/gittest.xcodeproj/project.pbxproj
#   new file:   gittest/gittest/en.lproj/InfoPlist.strings
#   new file:   gittest/gittest/gittest-Info.plist
#   new file:   gittest/gittest/gittest-Prefix.pch
#   new file:   gittest/gittest/gittestAppDelegate.h
#   new file:   gittest/gittest/gittestAppDelegate.m
#   new file:   gittest/gittest/iPad/en.lproj/MainWindow_iPad.xib
#   new file:   gittest/gittest/iPad/gittestAppDelegate_iPad.h
#   new file:   gittest/gittest/iPad/gittestAppDelegate_iPad.m
#   new file:   gittest/gittest/iPhone/en.lproj/MainWindow_iPhone.xib
#   new file:   gittest/gittest/iPhone/gittestAppDelegate_iPhone.h
#   new file:   gittest/gittest/iPhone/gittestAppDelegate_iPhone.m
#   new file:   gittest/gittest/main.m
#
# Changed but not updated:
#   (use "git add ..." to update what will be committed)
#   (use "git checkout -- ..." to discard changes in working directory)
#
#   modified:   gittest/gittest.xcodeproj/project.pbxproj
#
# Untracked files:
#   (use "git add ..." to include in what will be committed)
#
#   gittest/gittest.xcodeproj/project.xcworkspace/
#   gittest/gittest.xcodeproj/xcuserdata/

It's clear that XCode is modifying a git repository that it has not been told to manage. 很明显,XCode正在修改一个尚未被告知要管理的git存储库。

Has anyone encountered this before? 有没有人遇到过这个? I'm assuming that this is a feature and that there's some preference to disable it, but for the life of me I can't find it. 我假设这是一个功能,并且有一些偏好禁用它,但对于我的生活我找不到它。

I've experienced this annoyance as well and wish there were a way to disable it totally, however the only short-term solution I found was to do the following: 我也经历过这种烦恼,并希望有一种方法可以完全禁用它,但我找到的唯一短期解决方案是执行以下操作:

Window -> Organizer -> Repositories 窗口 - >管理器 - >存储库

Remove the entry for your repo and the IDE won't modify the repo. 删除repo的条目,IDE不会修改repo。 I have to do this every time I open an XCode session. 每次打开XCode会话时我都必须这样做。 I hope some one has a better way! 我希望有人有更好的方法!

For those having this problem and using xcode 6 its much easier. 对于那些有这个问题并使用xcode 6的人来说更容易。

Preferences -> Source Control 首选项 - >源代码管理

and then uncheck " Enable Source Control " or just uncheck add and " Remove files automatically ". 然后取消选中“ 启用源代码管理 ”或只取消选中“添加”和“ 自动删除文件 ”。

暂无
暂无

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

相关问题 如何创建一个git钩子来修改然后镜像git存储库? - How do I make a git hook for modifying then mirroring a git repository? 如何从本地 git 存储库和本地文件系统中删除文件,而不是从远程存储库中删除文件? - How do I remove a file from local git repository and local file system but not from remote repository? 在Xcode 4中如何将项目与我设置的本地Git存储库相关联? - in Xcode 4 how to associate a project to the local Git repository I set up? 如何将本地未推送的提交从损坏的 git 存储库移动到另一个存储库? - How do I move local, unpushed, commits from a corrupt git repository to another repository? 如何将文件从本地计算机添加到已克隆的本地git存储库中? - How do I add a file from my local machine to a local git repository that I have cloned? 当我尝试克隆不存在的存储库时,如何阻止 git 询问凭据? - How do I stop git from asking credentials when I try to clone a repository that doesn't exist? 如何使用VSO在XCode中创建GIT存储库? - How do I create a GIT repository in XCode using VSO? 如何将IntelliJ IDEA项目链接到本地​​git存储库? - How do I link an IntelliJ IDEA project to a local git repository? 如何将本地git存储库迁移到github? - How do I migrate a local git repository to github? iPhone:如何在“git local repository”中添加现有项目? - iPhone : How do I add existing project in “git local repository”?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM