This provides the solution for the recent security issue with Git that causes "Exception has been thrown by the target of an invocation" when linking a database to Git.
This will cause the following error message in the log files:
%localappdata% > Red Gate> Logs > SQL Source Control
Error|RedGate.Vcs.GitCommandLine.Commands.ThrowOnErrorCommandHandlerWithResult`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]|1| Git operation error from 'rev-parse --is-bare-repository': exit code 128, error: fatal: detected dubious ownership in repository at 'C:/GitHub/Development_Database
'
This error is due to a security update Git issues due to repository rights inheritance (you can read about it here) and there are multiple ways to handle it.
The simplest method, and one that Git recommends, is adding a repository trust (assuming it's known to be safe).
"git config --global --add safe.directory"
Example:
git config --global --add safe.directory C:/GitHub/Development_Database