Sourcetree fails to open Diffmerge for merge conflicts - atlassian-sourcetree

Recently I had a fresh install of macOS. I've installed Sourctree and diffmerge and set diffmerge as the default merge tool. For some reason everytime when I select 'Resolve Conflicts -> Open External Merge Tool' sourcetree opens its waiting view and directly closes it.
My settings page in sourcetree:
This is how my root .gitconfig looks like when sourcetree configures diff merge for me:
[core]
excludesfile = /Users/[username]/.gitignore_global
[user]
name = ---- -----
email = -----#-----.--
[commit]
template = /Users/[username]/.stCommitMsg
[credential]
helper = !/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/bin/java -Ddebug=false -Djava.net.useSystemProxies=true -jar /usr/local/Cellar/git-credential-manager/2.0.4/libexec/git-credential-manager-2.0.4.jar
[difftool "DiffMerge"]
[mergetool "DiffMerge"]
[diff]
tool = diffmerge
[difftool "diffmerge"]
cmd = /usr/local/bin/diffmerge \"$LOCAL\" \"$REMOTE\"
[merge]
tool = diffmerge
[mergetool "diffmerge"]
trustExitCode = true
cmd = /usr/local/bin/diffmerge --merge --result=\"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\"
[difftool "sourcetree"]
cmd = /Applications/DiffMerge.app/Contents/MacOS/DiffMerge/Contents/MacOS/DiffMerge --nosplash \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/DiffMerge.app/Contents/MacOS/DiffMerge/Contents/MacOS/DiffMerge --merge --result=\"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\"
trustExitCode = true

This happend to me when diffmerge was installed via the pkg install instead of the installer. This appearantly does not configure your bash to know the command diffmerge so than you have to set the path to the diffmerge (or update your bin config).
To solve this I manually configured Visual Diff Tool and Merge Tool (with as benefit that you can disable that annoying splash screen on launch everytime).
Settings page in sourcetree
Diff
Command: /usr/local/bin/diffmerge
Arguments --nosplash "$LOCAL" "$REMOTE"
Merge
Command: /usr/local/bin/diffmerge
Arguments --nosplash --merge --result="$MERGED" "$LOCAL" "$BASE" "$REMOTE"
The --nosplash argument is optional but prevents the (in my opinion useless) pop up that you always have to close before you can start your work.
Git config file:
[core]
excludesfile = /Users/[username]/.gitignore_global
[user]
name = ---------
email = ---------#------.--
[commit]
template = /Users/[username]/.stCommitMsg
[credential]
helper = !/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/bin/java -Ddebug=false -Djava.net.useSystemProxies=true -jar /usr/local/Cellar/git-credential-manager/2.0.4/libexec/git-credential-manager-2.0.4.jar
[difftool "DiffMerge"]
[mergetool "DiffMerge"]
[diff]
tool = diffmerge
[difftool "diffmerge"]
cmd = /usr/local/bin/diffmerge \"$LOCAL\" \"$REMOTE\"
[merge]
tool = diffmerge
[mergetool "diffmerge"]
trustExitCode = true
cmd = /usr/local/bin/diffmerge --merge --result=\"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\"
[difftool "sourcetree"]
cmd = /usr/local/bin/diffmerge --nosplash \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /usr/local/bin/diffmerge --nosplash --merge --result=\"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\"
trustExitCode = true
More info about diffmerge command line arguments:
Diff: https://sourcegear.com/diffmerge/webhelp/sec__clargs__diff.html
Merge: https://sourcegear.com/diffmerge/webhelp/sec__clargs__merge.html

I resolved this problem by following the instructions on the DiffMerge Settings for OS X documentation page, which was:
First confirm that /usr/local/bin/diffmerge is present.
If you used the PKG Installer, this was installed when /Applications/DiffMerge.app was installed.
If you used the DMG file, refer to the instructions for installing the Extras.
The following commands will update your .gitconfig to let GIT use DiffMerge:
$ git config --global diff.tool diffmerge
$ git config --global difftool.diffmerge.cmd
"/usr/local/bin/diffmerge \"\$LOCAL\" \"\$REMOTE\""
$ git config --global merge.tool diffmerge
$ git config --global mergetool.diffmerge.trustExitCode true
$ git config --global mergetool.diffmerge.cmd
"/usr/local/bin/diffmerge --merge --result=\"\$MERGED\"
\"\$LOCAL\" \"\$BASE\" \"\$REMOTE\""
I was then able to use DiffMerge by choosing the menu option in Sourcetree
(Optional) You may want to add --nosplash to both commands, before other parameters, to avoid the splash screen (as also recommended by #saren-inden). i.e.;
$ git config --global diff.tool diffmerge
$ git config --global difftool.diffmerge.cmd
"/usr/local/bin/diffmerge --nosplash \"\$LOCAL\" \"\$REMOTE\""
$ git config --global merge.tool diffmerge
$ git config --global mergetool.diffmerge.trustExitCode true
$ git config --global mergetool.diffmerge.cmd
"/usr/local/bin/diffmerge --nosplash --merge --result=\"\$MERGED\"
\"\$LOCAL\" \"\$BASE\" \"\$REMOTE\""

I got the same issue. DiffMerge is not launched either when I click External Diff.
The problem seems to be the path of DiffMerge in .gitconfig file:
cmd = /Applications/DiffMerge.app/Contents/MacOS/DiffMerge/Contents/MacOS/DiffMerge ....
If you check the path /Applications/DiffMerge.app/Contents/MacOS/DiffMerge, it's actually not a directory but a file. It seems SourceTree adds /Contents/MacOS/DiffMerge twice on the path. I removed the duplicate part and the External Diff starts working.
Haven't tried merge.

Related

Window 10 connection of Github , SSH issues

I am trying to connect git to GitHub. I am using window 10.
The SSH directory is not available.
$ cd .ssh
bash: cd: .ssh: No such file or directory
How can I connect the git to github?
Screenhot of git to github ssh connection problem
Windows 10 systems with build 1803 or newer and Windows Server 2019 come with an implementation of OpenSSH that's enabled by default. Some older versions may have this as an optional component that needs to be installed before it can be used.
Looks like in your case it may need to be installed (see if the folder "C:\Windows\System32\OpenSSH" exists and has files such as "ssh.exe" in it). If it is installed, then that directory needs to be added to the search path (type "echo %PATH%" in the command prompt window to see if it's in there).
Installation
Click on the "Settings" gear in the left pane of the Start Menu.
Click on "Apps".
Click on "Optional features".
Look in the list. If you do not see "OpenSSH Client", click "Add a feature".
"OpenSSH Client" and click "Install".
On analyzing deeper into the issue, it looks like you are searching or trying to cd to .ssh on the desktop which won't work.
Additionally, it looks like you are doing cat to a file that may not have existed as you have never generated public-private key pair(See ssh-keygen command for details)
Just try typing ssh and press enter to see that if it is actually the problem with ssh.
It should give output as(or similar to) :-
$ ssh
usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface]
[-b bind_address] [-c cipher_spec] [-D [bind_address:]port]
[-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]
[-i identity_file] [-J [user#]host[:port]] [-L address]
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
[-Q query_option] [-R address] [-S ctl_path] [-W host:port]
[-w local_tun[:remote_tun]] destination [command]
The .ssh directory is generally not available.
Not until you create it and use it with ssh-keygen (the one packaged with Git for Windows at C:\Program Files\Git\usr\bin\ssh-keygen.exe)
From a simple CMD:
cd %USERPROFILE%
mkdir .ssh
C:\Program Files\Git\usr\bin\ssh-keygen.exe -t rsa -P ""
You will get a:
%USERPROFILE%\.ssh\id_rsa (private key)
%USERPROFILE%\.ssh\id_rsa.pub (public key)
Copy the latter (the public key content) to your GitHub profile: that is how you associate Git to your GitHub account.
From there, you can open a Git bash session, and git clone using an SSH URL.
git clone git#github.com:me/myRepository

Pushing on a Git repository with Travis-CI

I want to execute a script every time I push into the master, this script will create some files that I want to commit and push. The log of the Travis build seems to be adding the files, committing and pushing, but nothing happens.
My .travis.yml is this one:
before_install:
- openssl aes-256-cbc -K $encrypted_290c3b2c061d_key -iv $encrypted_290c3b2c061d_iv -in id_rsa.enc -out /tmp/id_rsa -d
- eval "$(ssh-agent -s)" # Start the ssh agent
- chmod 600 /tmp/id_rsa
- ssh-add /tmp/id_rsa
install:
- wget --user $docencia_ac_username --password $docencia_ac_password http://docencia.ac.upc.edu/FIB/grau/PEC/Protegido/Documentacion/eines-sisa-64BITS.tgz
- tar -xf eines-sisa-64BITS.tgz
- export PATH=$PATH:$(pwd)/eines-sisa/bin
script:
- chmod +x ./compile_to_hex.sh
- "./compile_to_hex.sh"
after_success:
- rm -rf $TRAVIS_BUILD_DIR/tmp/
- git config --local user.name "Marc43"
- git config --local user.email "my mail"
- git add $TRAVIS_BUILD_DIR/hex/*
- git commit -m "At $(date) hex files builded - travis-ci [skip ci]"
- git push git#github.com:Marc43/sisa_hexbuilder.git master > /dev/null 2>&1
before_deploy:
- rm -rf eines-sisa*
in the git user.email it really goes my email but I decided to delete it for the question.
And the travis log for the build is:
$ git add $TRAVIS_BUILD_DIR/hex/*
$ git commit -m "At $(date) hex files builded - travis-ci [skip ci]"
[detached HEAD 10e7e48] At Sun Apr 15 08:06:17 UTC 2018 hex files builded - travis-ci [skip ci]
4 files changed, 21 insertions(+)
create mode 100644 hex/exemple.hex
create mode 100644 hex/joc_io.hex
create mode 100644 hex/tb_branch.hex
create mode 100644 hex/tb_sum.hex
I know that there is another way to do this via GitHub tokens or something like that, anyway I don't know how to do it one way or the other. I've tried to do it with the deploy too but it never uploaded my files, just tagged the same commit I did. Any ideas?
Thank you,
Marc
I run several repositories that need documentation compiling to distributable formats (e.g. AsciiDoc to HTML, MD to PDF), rather than having to build and commit every time I want to update the distributable, I’d like to automate this process. This is where I use TravisCI as a build server.
before_install:
- sudo apt-get install pandoc
- gem install asciidoctor
script:
- make
after_success:
- .travis/push.sh
env:
global:
secure: hZJlqgOzA2zIUJSWIka0PylqNaTkfHq+kS48RrHmocrK0vLyCW7ECWrzez2f2RVdTNzPi0b+yJq2uCbFfWjImZqg+XY1I75/CVVdSYMk7PJkYZ/iBDixMYY8CAkRRd5yZft9uZAdZzR4KLCPN18n7qfISv/M9VA8989NKcVyiEU=
push.sh
#!/bin/sh
setup_git() {
git config --global user.email "travis#travis-ci.org"
git config --global user.name "Travis CI"
}
commit_website_files() {
git checkout -b gh-pages
git add . *.html
git commit --message "Travis build: $TRAVIS_BUILD_NUMBER"
}
upload_files() {
git remote add origin-pages https://${GH_TOKEN}#github.com/MVSE-outreach/resources.git > /dev/null 2>&1
git push --quiet --set-upstream origin-pages gh-pages
}
setup_git
commit_website_files
upload_files
Reference - https://gist.github.com/willprice/e07efd73fb7f13f917ea

"git config --list" shows unexpected behaviour

I am new to GIT. On using the following command the terminal window shows the following image and at the end of it my user name and Email. This is very different from the GIT Manual. Why is this happening?
git config --list
Output in the terminal
Answer based on OP comment conversation:
Here, Many aliases got set in git config somehow. You can unset or edit your git config.
--global settings are saved in ~/.gitconfig file.
--local settings are saved in <repsitory>/.git/config file.
Open ~/.gitconfig file using terminal or any editor. Now remove the line you don't want in your git config list.
Unset using a terminal command:
$ git config --global --unset core.quotepath # remove your core 'quotepath'
$ git config --global --unset alias.a # remove your alias 'a'
Remove a whole section using terminal command:
$ git config --global --remove-section alias # remove the 'global alias' section
$ git config --local --remove-section alias # remove the 'local alias' section

How do I download a directory from github

Now I know there are several questions like this on overflow but several of these answers have failed miserably for me. I am using Cygwin, if it is relevant. I ran
svn export https://github.com/Wikia/app/tree/dev/extensions/wikia/AdminDashboard
to receive the result:
svn: E170000: URL 'http://github.com/Wikia/app/tree/dev/extensions/wikia/AdminDashboard' doesn't exist
I also ran
curl -L http://github.com/Wikia/app/tree/dev/extensions/wikia/AdminDashboard > project.tar.gz
to receive a .tar.gz file that 7-Zip fails to read the file giving the error:
Two remarks:
A GitHub repo would not work with svn command
the url does not exist.
A GitHub repo is best clone in its entirety, but you can do a sparse checkout as in this gist or this article:
New repository
mkdir <repo> && cd <repo>
git init
git remote add –f <name> <url>
git config core.sparsecheckout true
echo some/dir/ >> .git/info/sparse-checkout
echo another/sub/tree >> .git/info/sparse-checkout
git pull <remote> <branch>
Existing repository
git config core.sparsecheckout true
echo some/dir/ >> .git/info/sparse-checkout
echo another/sub/tree >> .git/info/sparse-checkout
git read-tree -mu HEAD
If you later decide to change which directories you would like checked out,
simply edit the sparse-checkout file and run git read-tree again as above.

How to do 'fossil' commands on relative directory?

I want to keep my linux config in fossil scm system.
Here is what I did at initial stage.
$ cd /
$ fossil new b.fsl
$ fossil open b.fsl
$ fossil add etc/group
$ fossil add boot/grub/menu.lst
$ fossil ci -m 'init commit'
I want do do things like (operate like hg/git).
$ cd etc
$ fossil status group
$ fossil add motd
It will show error message:
fossil: current directory is not within an open checkout
So, my temp dirty solution is
$ cd /
$ fossil status etc/group
$ fossil add etc/motd
$ fossil add /etc/motd # this line will cause problem
For my git/hg experiences, it should work.
$ cd /
$ hg init
$ hg add etc/group boot/grub/menu.lst
$ hg ci -m 'init commit'
$ cd etc
$ hg status group # it works
$ hg add motd # it works too
Before the command
$ fossil new b.fsl
Type the command
$ cd etc
If you want the fossil repo stored in another folder, change the commands
$ fossil new b.fsl
$ fossil open b.fsl
to
$ fossil new path_to_repo/b.fsl
$ fossil open path_to_repo/b.fsl
All mentioned commands "add" and "status" and all fossil commands related to the checkout must be executed when the current directory is set somewhere inside the directory tree of the checkout.
You can't specify the checkout directory yourself as a command line option.
It seems there is a bug (or intentionally introduced feature) in fossil that prevents it searching for the open checkout file (".fslchkout" or "FOSSIL") up to the root directory. That is why in this case you must be in the root directory when you execute commands on this checkout.
Of course all executions of fossil in this case must be with root privileges. Otherwise, even in the root directory you will get "not within checkout" error.
This situation is covered in great detail in the User Guide, which I recommend wholeheartedly.
http://www.fossil-scm.org/schimpf-book/home
In particular, see version 2.0 of the fossilbook.pdf, in section 2, entitled "Single Users", the section starting with:
I have a directory called FOSSIL in which I keep all my repositories, Fossil doesn’t care but it helps me to keep them all in one place so I can back them up.
The first command there shows how to call relative directories:
$ fossil new ../FOSSIL/FossilBook.fossil