In SAS Studio, the following message might occur when you clone Git Repositories:
'ERROR: Return code from GIT is (7). repository path '<Path_To_Repository>' is not owned by current user
This error occurs because the target directory fails the safe.directory check, which was added in libgit2 version 1.5. SAS recently upgraded the libgit2 version from 1.3.0 to 1.8.4 for SAS® 9.4M8 (TS1M8), SAS® 9.4M9 (TS1M9), and the SAS® Viya® platform in order to support OpenSSL 3.
Libgit2 does honor Git config settings, so you need to add the directory to the safe.directory list. The Git implementation at SAS does not have a way to set a config option via the Git functions, so you either need to manually edit the global config file or use Git bash to add the directory.
The safe.directory in Git is a security feature that tells Git which directories are trusted, even if they are owned by a different user. To fix the unsafe repository warning, you need to add the repository's path to your Git configuration using a command like git config --global --add safe.directory "". For convenience, you can use $(pwd) or %(prefix)///<path> to reference the current directory in the command.
To circumvent the unsafe repository warning, pen your terminal and navigate to the root of the repository where the error occurs.
Run the following command to add the directory as safe:
It is necessary to fix this warning because this feature was introduced to prevent malicious code from running on repositories that are not owned by the current user.