Can't commit changes to local git repository

前端 未结 5 725
醉话见心
醉话见心 2021-02-12 23:50

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

相关标签:
5条回答
  • 2021-02-13 00:06

    If your project is in /Developer/.... move it elsewhere and reopen the project. This may resolve your problem.

    There seems to be a problem under Xcode 4.2 with projects in /Developer/... and git integration (you get the error "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")

    0 讨论(0)
  • 2021-02-13 00:10

    I know this has already been answered but this worked for me:

    Open terminal

    cd yourprojectdirectory
    git config --global user.email "youremail@email.com"
    git config --global user.name "username"
    
    0 讨论(0)
  • 2021-02-13 00:12

    I've experienced and recovered from this.

    I can't tell you what causes it but, notably, in the "Repositories" view in my Organiser, I had TWO similarly-named repositories. What differed about them was the case of one of the paths.

    One was "~/Work/Code/Bumhole" and the other "~/work/Code/Bumhole".

    I caused the problem by XCode crashing during a commit to the repository (of many changes).

    I fixed the problem by

    • closing the offending project
    • closing Xcode
    • rebooting
    • reopening Xcode
    • (close the project if its open)
    • open the Organiser view
    • Select the "bad" repository and delete it with backspace
    • Navigate the remaining "good" repository until you see the .xcodeproj file
    • Double click the .xcodeproj file to open the project

    I expect this list is a superset of the steps needed to fix the problem, but this worked for me.

    0 讨论(0)
  • 2021-02-13 00:20

    This bug still exists in Xcode 4.6.3 and when using Subversion.

    0 讨论(0)
  • 2021-02-13 00:26

    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.

    0 讨论(0)
提交回复
热议问题