Fix git secure path

This commit is contained in:
VirtuBox
2022-04-28 15:07:12 +02:00
parent 07abbcaad5
commit 5178bb82d3
2 changed files with 14 additions and 12 deletions

View File

@@ -207,6 +207,7 @@ wo_install_dep() {
wo_linux_distro=$(lsb_release -is) wo_linux_distro=$(lsb_release -is)
if [ "$wo_linux_distro" == "Ubuntu" ]; then if [ "$wo_linux_distro" == "Ubuntu" ]; then
# install dependencies # install dependencies
add-apt-repository ppa:git-core/ppa -y
apt-get --option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \ apt-get --option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \
build-essential curl gzip python3-pip python3-apt python3-venv gcc python3-dev sqlite3 git tar software-properties-common pigz \ build-essential curl gzip python3-pip python3-apt python3-venv gcc python3-dev sqlite3 git tar software-properties-common pigz \
gnupg2 cron ccze rsync apt-transport-https tree haveged ufw unattended-upgrades tzdata ntp zstd idn \ gnupg2 cron ccze rsync apt-transport-https tree haveged ufw unattended-upgrades tzdata ntp zstd idn \
@@ -785,6 +786,12 @@ wo_php_fix() {
fi fi
} }
wo_git_secure_path() {
if ! grep -q "directory = *" ~/.gitconfig; then
echo -e "\n[safe]\n directory = *" >> ~/.gitconfig
fi
}
### ###
# 4 - WO MAIN SETUP # 4 - WO MAIN SETUP
### ###
@@ -851,6 +858,7 @@ else
_run secure_wo_db _run secure_wo_db
wo sync wo sync
_run wo_git_secure_path
if [ "$ee_migration" = "1" ]; then if [ "$ee_migration" = "1" ]; then
echo echo

View File

@@ -1,10 +1,8 @@
"""WordOps GIT module""" """WordOps GIT module"""
import os import os
from pathlib import Path
from sh import ErrorReturnCode, git from sh import ErrorReturnCode, git
from wo.core.logging import Log from wo.core.logging import Log
from wo.core.fileutils import WOFileUtils
class WOGit: class WOGit:
@@ -31,11 +29,7 @@ class WOGit:
Log.debug(self, "{0}".format(e)) Log.debug(self, "{0}".format(e))
Log.error(self, "Unable to git init at {0}" Log.error(self, "Unable to git init at {0}"
.format(path)) .format(path))
if not WOFileUtils.grep(self,
"{0}/.gitconfig".format(Path.home()),
"{0}".format(path)):
git.config("--global", "--add", "safe.directory",
"{0}".format(path))
status = wogit.status("-s") status = wogit.status("-s")
if len(status.splitlines()) > 0: if len(status.splitlines()) > 0:
try: try: