无法将更改提交到本地git存储库 [英] Can't commit changes to local git repository

查看:185
本文介绍了无法将更改提交到本地git存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个新项目并检查了创建本地git存储库选项。我打开组织者检查是否有我的项目存储库,它在那里。我对一些文件做了一些修改,并注意到它们旁边的源代码控制特定字母A..M,但是当我选择:File-> Source Control-> Commit时,我从XCode 4.2中得到以下消息:



操作无法执行,因为找不到有效的工作副本



请验证您的文件是否受源代码管理,然后重试



然而,我打开并注意到我的项目存储库在左侧栏上包含三个图标:分支,远程和与项目名称相同的文件夹。我选择了最后一个(文件夹)并按下了组织者底部栏上的提交按钮。提交表打开,我成功执行提交。现在,当我关闭组织器并编辑项目中的某些文件时,我看不到每个修改文件旁边的源控制特定字母M...A。



我的问题是两点:1)为什么我不能从文件 - >源代码控制 - >提交菜单选项 p>

2)当我从存储库本身提交并返回到项目并编辑一些文件时,为什么我在修改的文件旁边看不到源代码控制字母?]

解决方案

对于它的价值(以及@ Jahelia的评论中提到的),这似乎是XCode 4.2中的一个bug,它首次与git 。解决方法似乎是至少关闭Xcode并重新打开。 (如果这不起作用,请尝试打开和关闭管理器。)



我今天第一次尝试使用Xcode的Git时遇到了这个问题。我使用创建本地git存储库选项创建了两个演示项目,并且他们遇到了同样的问题。我能够从组织者窗口提交,但主要的Xcode文件视图根本没有认出git。



退出并重新启动后,我创建了第三个使用git选项进行演示,并且主窗口从蝙蝠中识别出修改(在构建之后) - 即在修改后的文件旁边显示M。

I have created a new project and checked the "create a local git repository" option. I opened the organizer to check that there is a repository for my project and it was there. I made some changes on some files, and noticed the source control specific letters "A" .. "M" beside them, but when I choose: File-> Source Control -> Commit, I get the following message from XCode 4.2:

the operation could not be performed because no valid working copies were found

Please verify that your files are under source control and try again

However, I opened the organizer again, and noticed that the repository of my project includes three icons on the left bar: Branches, Remotes and a folder with the same name as of the project. I chose the last one (the folder) and pressed the Commit button on the bottom bar of the organizer. The commit sheet opened and I performed the commit successfully. Now, when I close the organizer, and edit some files in my project, I do not see the source control specific letters "M" ... "A" ... beside each modified file.

My problem is about two points:

1) Why can't I commit from File->Source Control->Commit menu option

2) When I commit from the repository itself, and go back to the project and edit some files, why do not I see source control letters beside modified files?]

解决方案

For what it's worth (and as @Jahelia's comment mentions), this seems to be a bug in XCode 4.2 when it first engages with git. The workaround seems to be to at least close Xcode and reopen. (If that doesn't work, try opening and closing the organizer.)

I encountered this myself today when trying out Git with Xcode for the first time. I created two demo projects with the "create a local git repository" option and they had the same problem. I was able to commit from the organizer window, but the main Xcode file view didn't seem to recognize git at all.

After quitting and restarting, I created a third demo with the git option, and the main window recognized the changes (after building) right off the bat - i.e showed the "M" beside a modified file.

这篇关于无法将更改提交到本地git存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆