34

I've recently updated to OSX Sierra (from El Capitan) and to Xcode 9. I removed all compatibility issues (like autolayout issues) and would like to commit to my local gitrep now.

the following error appears:

enter image description here

I thought it might be the same bug appeared in XCode 7 mentioned here: Xcode and Git Source Control : “The working copy XXXXX failed to commit files”

enter image description here

But it wasn't. I tried the solution mentioned above. Username and EMail are properly set. I did save everything, tried restarting the machine and a few other minor things. Nothing worked - i can't commit.

Any help appreciated.

EDIT

I got it to work by commiting manually and adding changes before with

git commit -a -m "Fixes"

I will keep an eye on that if it happens again once i made more changes and report here if so.

Pat_Morita
  • 3,125
  • 3
  • 20
  • 35

5 Answers5

38

The solution is to add changes once with a git command. Use terminal and navigate to Xcode project folder. If you are in the right folder, this command:

ls -al

will list a .git folder. Then you know you're at the right place. Then execute

git commit -a -m "Commit title here"

After that commit via Xcode should work again.

Pat_Morita
  • 3,125
  • 3
  • 20
  • 35
  • 2
    for me commit is done via terminal, but still issue is coming for Xcode. I have to do that again n again via terminal. any solution? – RBN Jan 05 '18 at 07:28
  • I tried using source tree to commit but it didn't fix xcode problem, you'll need use terminal its true. – AaoIi Feb 16 '18 at 13:36
  • I had the same problem after upgrading to Xcode 10.2 Setting the name and email from the terminal worked for me: $ xcrun git config --global user.name "your name" $ xcrun git config --global user.email your.email@example.com [No double quotes in email] After that i had to restart Xcode and it was working fine again. – Niraj May 24 '19 at 10:39
30

For me I had to populate Full Name and Email address in Preferences > Source Control > GIT (tab). They were blank.

Ryan R
  • 8,161
  • 15
  • 80
  • 109
  • 2
    even though this wasn't the question asked, this helped me thanks – Vinh Apr 02 '18 at 15:31
  • this is the *only* solution that I came across, thanks! – AamirR Dec 12 '18 at 19:45
  • it isnt. Although it is the solution for others and the same issues the question excludes this answer as already tested. – Pat_Morita Apr 05 '19 at 10:51
  • Thank you, this worked for me. But I had to do this, THEN create the project. It was much simpler, safer, than trying to fix the un-SCM'd project. – Womble Apr 29 '19 at 01:28
  • I should also note that I had ALREADY populated those fields in a previous version of Xcode, but Xcode 10.2.1 emptied those fields, leading to their (terribly named) error. Xcode... the perennial beta. – Womble Apr 29 '19 at 01:29
  • If you cant change the git name in Xcode, check here: https://stackoverflow.com/a/55691470/6108739 – Vladyslav Panchenko Aug 29 '19 at 18:48
10

If you cant change the git name in Xcode, you can change username and email using the terminal:

xcrun git config --global user.name 'new_user_name'
xcrun git config --global user.email 'new@email.com'

And restart Xcode.

Vladyslav Panchenko
  • 1,447
  • 1
  • 15
  • 23
  • 1
    My entries of name and email were not being saved by Xcode 10.2.1 in the GIT tab as described above. With Xcode open I executed the commands above in terminal, restarted Xcode and the commit problem was solved. Much appreciated Vladyslav. – bitsand May 10 '19 at 01:10
0

For me, the Preferences> Source Control > Git > Ignored Files had the Watchkit Extension Complications Controller. Removing it from Ignored Files fixed the problem. Xcode 10.1, Watch OS 4.2.

Nelson Capes
  • 431
  • 3
  • 12
0

the problem that I had was whenever I tried to create source control it show Couldn’t communicate with a helper application. so in Xcode preferences I go to accounts and there I see I was logged out I signed in again and save the project, after closing the project and force quitting Xcode I opened it again and now it works fine for me

Mohammad Yunus
  • 206
  • 1
  • 9