xcode 无法识别 Git 项目
我有一个通常使用 Xcode 4 的项目,但是自从升级到 Lion 和 Xcode 4.1 后,我似乎无法再提交更改了。我的项目文件夹中有 git setup 。我尝试使用终端提交,但在 xcode 中我只有“无法加载修订”消息。
在文件中->源代码控制,很多东西也都是灰色的。
有谁知道如何解决这个问题?
只是为了提供帮助,我尝试过:
- 提交表单终端
- 确保 git 安装在 /usr/local/git
- clean install
- 从组织者中删除项目并再次将其添加回来
I have a project that usually works with Xcode 4, however since upgrading to Lion and Xcode 4.1 it doesn't seem that I can commit my changes anymore. I have git setup in my project folder. I've tried to commit using terminal, but in xcode I only have the "Unable to load revisions" message.
In File -> source control, many things are grayed out as well.
Does anyone know how to fix this?
Just to help, I've tried:
- commiting form terminal
- making sure git installed in /usr/local/git
- clean install
- remove project from organizer and add it back again
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我不确定我做了什么,但是重新启动计算机后,它似乎又可以工作了...所以,如果你们遇到一些问题,请先尝试重新启动计算机:)
I'm not sure what I did, but after restarting my computer it seems to be working again... So if you guys are having some problems try to restart your computer first :)
您可能想尝试从源代码菜单中“提交”。我刚刚看到这个问题,并在选择它后收到一条明显的错误消息。 (XCode 被我的 .gitconfig 文件窒息了)。
You might want to try and "Commit" from the source code menu. I just saw this issue and got a sensible error message after selecting it. (XCode was choking on my .gitconfig file).
我有一种“预感”,这是由 Time Machine 进行本地备份(快照)引起的。如果您在未连接到外部备份硬盘驱动器时关闭 Time Machine(例如,您在笔记本电脑上移动),我“认为”它会阻止 git 发生问题。
Git 可以通过 CLI 运行。如果 Xcode 向您显示 project is not recognize 消息,并且各种菜单项呈灰色显示,您仍然可以 cd 进入目录并执行
git add .
,然后执行git commit -m "commit message"
就可以了。此外,git log
可以正确报告内容。存储库看起来不错。所以这基本上是 Lion 上 Xcode 4.1(build 4B110)的一个错误。关闭项目并重新启动“有时”为我解决了这个问题,但其他人却没有。可能需要第二次或第三次重新启动。或者,当您未连接到外部硬盘时,完全关闭 Time Machine。
更新:经过更多实验,此故障似乎不是由时间机器引起的。无论它是打开、关闭还是有排队备份,故障仍然会发生。
I have a "hunch" this is caused by Time Machine doing local backups (snapshots). If you shut Time Machine off when you're not connected to your external backup hard-drive (e.g. you're mobile on a laptop), I "think" it stops the issues with git from occuring.
Git does work from CLI. If Xcode gives you the project is not recognized message with various menu-items grayed out, you can still cd into the directory and do
git add .
followed bygit commit -m "commit message"
and it'll work. Also,git log
reports things correctly. The repository looks fine.So it basically is a bug with Xcode 4.1 (build 4B110) on Lion. Closing a project and rebooting has fixed it for me "sometimes", but not others. A 2nd or 3rd reboot might be necessary. Or, shut off Time Machine completely when you're not connected to your external HD.
UPDATE: After some more experimentation, this glitch does not appear to be caused by Time Machine. Regardless if it's on, off, or has a queued backup, the glitch still occurs.
这是上述所有内容的混合,但我刚刚解决了问题。我几乎肯定会因为在不同时间在几个不同的驱动器之间复制我的项目而陷入混乱。存储库在 Xcode 中有“无法加载修订版本”消息。
我从这里下载了命令行 Git 程序(不是 GUI,这似乎没有帮助):git-scm
我运行了安装程序并重新启动了终端以使路径正常工作。我按照 Xcode 文档中设置 Git 存储库的说明进行操作,但是这当然失败了,因为那里已经有一个了。所以我关闭了项目,然后 Xcode 转到 Finder 并删除了 .git 目录。这是一种残酷的做法!您将失去之前所有更改的知识。
如果看不到隐藏目录,则需要从终端运行此行:
defaults write com.apple.Finder AppleShowAllFiles YES
然后我再次按照 Xcode 文档中的说明进行操作:
git init
git add 。
git commit -m“初始提交”
修复了它。希望它对其他人有帮助。
This is a blend of all of the above but I just fixed the problem. I almost certainly got myself into the mess by copying my project between several different drives at different times. The repository had the "Unable to load revisions" message in Xcode .
I downloaded the command line Git program (not the GUI, that did not seem to help) from here:git-scm
I ran the installer and restarted the terminal to get the paths working. I followed the instructions for setting up a Git depository from the Xcode documentation, but of course this failed because there was already one there. So I closed the project and Xcode then went to Finder and deleted the .git directory. This is a brutal approach! You will lose knowledge of all previous changes.
You need to run this line from the terminal if you cannot see the hidden directories:
defaults write com.apple.Finder AppleShowAllFiles YES
Then I followed the instructions from the Xcode docs again:
git init
git add .
git commit -m "Initial Commit"
That fixed it. Hope it helps someone else.
从 Xcode 11.2.1(以及 Xcode 12)开始,我也遇到了同样的问题(Git 源控制的 Xcode 工作区没有显示任何更改),并且 Source Control > >提交没有显示任何内容。我尝试重新启动计算机,但根本没有解决问题。
为了解决这个问题,我进入终端并导航到 Xcode 项目的根文件夹。然后在项目根目录中发出以下命令:
刷新 Git 状态一段时间后,Xcode 开始在 Source Control > > 中显示更改。再次提交和文件层次结构。就像魅力一样起作用。
As of Xcode 11.2.1 (as well as Xcode 12), I encountered the same problem as well (Git-source-controlled Xcode workspace does not show any changes), and the Source Control > Commit shows nothing. I tried to reboot the computer but does not solve the problem at all.
To solve this problem, I went to the Terminal and navigate to the root folder of the Xcode project. Then issue the following command in the project root directory:
After it refreshes the status of the Git for a while, Xcode starts showing up the changes at Source Control > Commit and the File Hierarchy again. Works like charm.