1

I have inside my .gitconfig

[merge]
    tool = intellij
[mergetool "intellij"]
    cmd = /usr/local/bin/idea merge $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE") $(cd $(dirname "$BASE") && pwd)/$(basename "$BASE") $(cd $(dirname "$MERGED") && pwd)/$(basename "$MERGED")
    trustExitCode = true

so I can run git mergetool and get Intellij IDEA's mergetool.

The problem with this is since we are executing from /usr/local/bin/idea requires admin privileges. However, if I run sudo git mergetool IDEA would run this time, but as sudo, causing all the files changed to have changed permissions, in particular, changing the ownership of the file. Further it does not load user-specific config when running as sudo.

What would be the solution?

Saravanabalagi Ramachandran
  • 8,551
  • 11
  • 53
  • 102

1 Answers1

1

executing from /usr/local/bin/idea requires admin privileges

Typical permissions of executables in /usr/local/bin are 755, which means anyone can run executables from there. (checked on Mac and Ubuntu 18/04 - permissions are the same).

Looks like something is misconfigured on the system so that running ide wrapper requires sudo.

Check and adjust permissions /usr/local/bin/idea accordingly.

Dmitrii Smirnov
  • 7,073
  • 1
  • 19
  • 29