The following could be used to get the path for the git binary included with GitHub Desktop for macOS:
find_github_desktop_bin <- function() {
apple_script = "use framework \"Foundation\"
use framework \"AppKit\"
set bundleID to id of application \"GitHub Desktop\"
set theWorkspace to current application's NSWorkspace's sharedWorkspace()
set thePath to ((theWorkspace's URLForApplicationWithBundleIdentifier:bundleID)'s |path|()) as text
return thePath"
github_desktop_base <- system(paste('osascript','-e', shQuote(apple_script)), intern = TRUE)
github_desktop_bin <- paste(github_desktop_base, '/Contents/Resources/app/git/bin/git', sep='')
return(github_desktop_bin)
}
The following can be used to set the configuration in RStudio: rstudioapi::writeRStudioPreference('git_exe_path', find_github_desktop_bin())
And the the Windows location seems to be %LOCALAPPDATA%\GitHubDesktop\app-[gfw-version]\resources\app\git\cmd\git.exe. There might be some commands [1, 2, 3] to locate program executable?
The git version embedded in GitHub Desktop does not support the commands that RStudio use for pushing or pulling. Other than that the functions for adding, committing and reverting files seems to work.
The following could be used to get the path for the
git
binary included with GitHub Desktop for macOS:The following can be used to set the configuration in RStudio:
rstudioapi::writeRStudioPreference('git_exe_path', find_github_desktop_bin())