brew update: Error in terminal mac - macos

error: Your local changes to the following files would be overwritten by merge:
Library/Contributions/brew_bash_completion.sh
Library/Contributions/brew_fish_completion.fish
Library/Contributions/brew_zsh_completion.zsh
Library/Contributions/manpages/brew.1.md
...
Library/Formula/dmtx-utils.rb
Library/Formula/docbook-xsl.rb
Library/Formula/dromeaudio.rb
Library/Formula/dub.rb
Library/Formula/dvorak7min.rb
Library/Formula/dyld-headers.rb
Library/Formula/dylibbundler.rb
Library/For
Aborting
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master

I've seen this a few times and don't know what causes it; but if you're sure you haven't made any modifications to those files that you want to save, you can go into /usr/local (or wherever you keep the Homebrew installation) and type git reset --hard HEAD. Then try updating again.

Deleting files and reinstalling HOMEBREW solved the problem.

Related

How do I fix the 'Could not reset index file to revision 'HEAD'' problem in Xcode?

I am trying to start my Xcode and I receive a warning that says: '“Project” is currently in conflict. Do you want to abort the current operation?' I press abort and I get this error:
Could not reset index file to revision 'HEAD'.'
I have been unable to pull from repositories and unable to checkout other branches. I tried to fix this by using the terminal but it did not work.
I've got the same message during I wanted to abort an ongoing merge(messed up something during merge conflicts). I assume that XCode tried to refresh your branch automatically or something in that direction.
So, I tried:
git merge --abort
which gave me the same error message:
error: Entry 'some/package/Broken.java' not uptodate. Cannot merge.
fatal: Could not reset index file to revision 'HEAD'.
I openend 'git gui' and unstaged the automatic staged classes. After this an abort worked with:
git merge --abort
This was done on git bash console.
Looks like more of a git conflict issue. You can undo a git merge with conflicts doing
git merge --abort
Hope that helps!

How do I get around "Filename too long" error when running `chef install` on Windows 10?

I'm transitioning from berkshelf to the Policyfile workflow, and everything was running fine until I attempted to resolve all the dependencies. Two of my dependencies are from git, so when I run chef install in the cookbook directory, I get the following error:
Error: Failed to generate Policyfile.lock
Reason: (CookbookOmnifetch::GitCommandError) Git error: command `git reset --hard 7e5e4bccf57718cacc246f1b4d501ff7de8ac13d` failed. If this error persists,
try removing the cache directory at 'C:/Users/pcummuskey/AppData/Local/chefdk/cache/.cache/git/780b7dbee933c3a9efbfd3898d54cdf72784fa7e'.Output from the command:
error: unable to create file test/kitchen/.kitchen/tmp/librarian/cache/source/chef/site/877777683730772c36b1e6a3fc3aa2c3/windows/version-uri/a3432e93fb3c21cb7111fde71e435661/package/files/default/handlers/windows_reboot_handler.rb: Filename too long
Checking out files: 100% (389/389), done.
fatal: Could not reset index file to revision '7e5e4bccf57718cacc246f1b4d501ff7de8ac13d'.
Predictably, removing the cache folder had zero effect on the problem. I'm in the middle of checking whether I can get it working in the ubuntu subsystem and/or docker atm, but it'd be nice to be able to run it natively on Windows.
I don't get this problem using "git bash" (MINGW64) packaged in Git for windows installer.
As an example:
$ pwd
/c/Users/foobar/AppData/Local/chefdk/cache/.cache/git/13036489648c6f8811262c6a50ff6b03da2395b7/4416ca3886d025b3ead519f1ee53af03ecb630f64416ca3886d025b3ead519f1ee53af03ecb630f64416ca3886d025b3ead519f1ee53af03ecb630f64416ca3886d025b3ead519f1ee53af03ecb630f6/4416ca3886d025b3ead519f1ee53af03ecb630f64416ca3886d025b3ead519f1ee53af03ecb630f64416ca3886d025b3ead519f1ee53af03ecb630f61
Managed to work around the issue by making a local cookbooks folder and checking out the dependencies to there and referencing them by path. It's not pretty, but it does the trick.

Unable to create '/git/index.lock': File exists - but it doesn't

I'm getting this message when trying to rebase interactively using source tree.
If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
fatal: Unable to create 'X:/sources/project/.git/index.lock': File
exists.
The problem is that X:/sources/project/.git/index.lock doesn't exist
All the other solutions on SO didn't work for me since they all say to remove this file.
I'm on a Mac and ran into basically the same issue.
When running git rebase -i master, I received an error:
fatal: Unable to create 'path/to/file/.git/index.lock': File exists.
The index.lock file didn't exist in my .git/ directory. But there was an index file (no filetype extension). So I aborted the rebase.
After a ton of searching, I finally decided to just create the file:
touch .git/index.lock
I tried rebasing again, but that didn't fix the issue (this time the file really did exist). So I removed it:
rm .git/index.lock
That did the trick. The rebase had conflicts this time (which was odd since I aborted the rebase previously), but I just addressed each conflict and then let the rebase continue:
git rebase --continue
I hope this helps someone else who ends up in a similar situation.
Use rm -rf X:/sources/project/.git/index.lock to remove the lock and save yourself a headache. Also, the index.lock exists, however, the .git folder is hidden. So, use ls -la X:/sources/project/.git to see the content of a hidden folder.
I had the same issue using Github Desktop. I watched the .git directory and the index.LOCK file would appear and disappear. It never persisted for long, so was not there to delete. I investigated a little as other solutions online did not work for me and found that comparing permissions to folders that I was able to commit they had one difference: the .git folder that gave me the error had full control like the others, but it was inherited from its parent. I went to properties->security->advanced and removed then re-added the permissions without inheriting them from the parent. After that I was able to commit my changes without an error.
OK, this is really strange, but for me, the following worked:
Create the file .git/index.lock from Windows explorer
Delete the file again (from git bash, I don't know if this is important)
Then, the command I was executing (git rebase --continue, in my case) succeeded. I have no idea why this procedure worked, though. This should not make any difference...
I disabled indexing of the .git folder and it helped to me to get rid of the message
#Manza: I came across the same issue. There is no index.lock file existing and still it throws an error related to file existence.
I created a patch of my changes and did a clone again. Now when I do a commit, it works all fine. I know this is not the right direction. But this is the go to when the index.lock doesn't get created and still we get this error.
for ios mac remove rm -rf from this location .git/modules/ios or can manual delete
Step —
1)-Open terminal .
2)-Open project file location.
3)-Rum command - defaults write com.apple.finder AppleShowAllFiles YES.
Now u can see hidden file in Mac OS.
4)-Rum command - cd .git/modules/ios (In my case I am running React code).
5)-Now either open folder and delete index.lock or use “rm” command .
6)-Thats its - now try to commit and push .

The working copy <Project name> failed to commit files. - The repository has an uncompleted operation

I've just updated my Xcode from 6 to 7 (and code from Swift 1.2 to Swift 2.0) and try to create new branch in Xcode. After that I can't push my code to Bitbucket.
Is there a way how can I delete repository from directory and setup Bitbucket again and maybe push to another (a new one) repository? Fix of this problem will be great, but I will be satisfied even with move to another repository.
I had this error in xcode 7.1 on a year old project that was working fine. In my case I have a project with the default local repository created by xcode. For anyone who is not going to re-install and re-setup. It is possible to find out what the dangling command is and fix it from command line.
To find the dangling command Open Terminal from the project directory:
xcrun git status
In my case the status returned:
On branch master
You are currently rebasing.
(all conflicts fixed: run "git rebase --continue")
To fix the problem I used:
xcrun git rebase --skip
In my case I ran git status which revealed that You are currently bisecting. (I was doing a bisect and must had forgotten to reset). I did a git bisect reset and attached the head to my latest commit and it was all fine afterwards.
When I am merging from currentBranchA into branchB, I got conflicts,I didn't want to solve the conflicts immediately and quit the merging process. But when I try to merge again, the Xcode shows "The working copy is currently in the middle of another operation..."
I opened the terminal ,cd to the project directory, and check the git status:
git status
it shows:
On branch currentBranchA
Your branch is up to date with 'origin/currentBranchA'.
All conflicts fixed but you are still merging.
(use "git commit" to conclude merge)
Just do it as it says. Continue to input
git commit and click Ctrl + C to close the commit message window.
The problem will be zero.
The problem was with installation of GitHub. I had a master repository. After reinstall and resetup everything works like before.
EDIT: For anyone who has a problem with Xcode and GIT I have a best advice. Don't use it. Use for example Source Tree
When you start developing for a living, you are gonna have to use more reliable solution for GIT. Imagine you have 70 branches. Using Source Tree you can easily solve conflicts and other things about working in team. Xcode GIT solution is not reliable and you are gonna be only frustrated.

Issues with git branch checkout due to untracked working tree files

I thought I put the days of Xcode + git issues behind me. Guess not. I am getting this git error when trying to checkout another branch.
error: The following untracked working tree files would be overwritten by checkout:
RCAlpha.xcodeproj/project.xcworkspace/xcuserdata/andrewjl.xcuserdatad/UserInterfaceState.xcuserstate
RCAlpha.xcodeproj/xcuserdata/andrewjl.xcuserdatad/xcschemes/RCAlpha.xcscheme
RCAlpha.xcodeproj/xcuserdata/andrewjl.xcuserdatad/xcschemes/xcschememanagement.plist
Please move or remove them before you can switch branches.
Aborting
Very well I say, let me remove these files:
andrewjl$ git rm --cached RCAlpha.xcodeproj/project.xcworkspace/xcuserdata/andrewjl.xcuserdatad/UserInterfaceState.xcuserstate
fatal: pathspec 'RCAlpha.xcodeproj/project.xcworkspace/xcuserdata/andrewjl.xcuserdatad/UserInterfaceState.xcuserstate' did not match any files
At this point I'm not sure what to do. These files are all listed in my .gitignore and I also gave git clean -f -d a try as well. No dice. Anyone know what's going on here?
The files are untracked: git rm --cached cannot find them because there are not in the index. Just delete them, using your file manager or rm. Then checkout should work as expected. Note that git status will show you what git sees the files as (tracked, changed, untracked; with an additional option it will also display ignored files).
they arent in git but there locally .. that means when you switch those would be lost and git doesnt allow that
remove them locally:
rm RCAlpha.xcodeproj/project.xcworkspace/xcuserdata/andrewjl.xcuserdatad/UserInterfaceState.xcuserstate RCAlpha.xcodeproj/xcuserdata/andrewjl.xcuserdatad/xcschemes/RCAlpha.xcscheme RCAlpha.xcodeproj/xcuserdata/andrewjl.xcuserdatad/xcschemes/xcschememanagement.plist
they are recreated by xcode anyway. nothing important in there!
Try this
git rm --cache */xcschemes/xcschememanagement.plist
git commit -m "Good bye xcschememanagement.plist"
Git stash and git checkout "yourBranch"
git clean -f
solve the problem for me, they are untracked files when run clean they get remove.

Resources