Defining which git repo to make use of

I have a bash manuscript, called cgit, that works as git for one details git repo (situated at /.git) :

#!/bin/bash
cd /;
sudo git [email protected] > /dev/stdout

I utilize it to track imporant system submits:

cgit add /etc/rc.conf

The problem is when I attempt to add web content about the directory site I'm in, as an example:

cd /home/user
cgit add .ssh/config

cgit would certainly attempt and also add /.ssh/config to the /.git repo.

Any kind of pointers or work-arounds?

0
2019-05-05 05:17:17
Source Share
Answers: 2

I would certainly upgrade your cgit manuscript to make use of --git-dir. From the male web pages :

   --git-dir=<path>
       Set the path to the repository. This can also be controlled by
       setting the GIT_DIR environment variable. It can be an absolute
       path or relative path to current working directory.
.

So it would certainly come to be :

#!/bin/bash
sudo git --git-dir=/.git [email protected] > /dev/stdout
.

FTR, I have not attempted it.

0
2019-05-08 07:38:23
Source

Much far better to make use of etckeeper as opposed to your very own residence - expanded remedy. There are variety of gotchas that etckeeper addresses perfectly. It's a plan in numerous Linux distros, and also is additionally very easy to construct from resource.

An actually wonderful attribute on Debian - based systems is that it connects proper to instantly devote in the past and also after mounting or upgrading plans. This aids identify adjustments you made on your own from ones made by plan updates. It additionally (additionally) does a day-to-day autocommit.

0
2019-05-08 06:29:53
Source