* how to git a read only directory
@ 2009-01-21 8:33 bill lam
2009-01-21 9:57 ` Michael J Gruber
2009-01-21 12:34 ` Boaz Harrosh
0 siblings, 2 replies; 10+ messages in thread
From: bill lam @ 2009-01-21 8:33 UTC (permalink / raw)
To: git
I want to use git to keep track of files inside /etc but do not want
to do it as a super user. Is that possible to put GIT_DIR under my
home directory and add public-read files inside /etc? Or that it could
be done in some other ways.
Thanks.
--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩164 張喬 書邊事
調角斷清秋 征人倚戍樓 春風對青塚 白日落梁州
大漠無兵阻 窮邊有客遊 蕃情似此水 長願向南流
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: how to git a read only directory
2009-01-21 8:33 how to git a read only directory bill lam
@ 2009-01-21 9:57 ` Michael J Gruber
2009-01-21 15:48 ` bill lam
2009-01-21 12:34 ` Boaz Harrosh
1 sibling, 1 reply; 10+ messages in thread
From: Michael J Gruber @ 2009-01-21 9:57 UTC (permalink / raw)
To: git, cbill.lam
bill lam venit, vidit, dixit 21.01.2009 09:33:
> I want to use git to keep track of files inside /etc but do not want
> to do it as a super user. Is that possible to put GIT_DIR under my
> home directory and add public-read files inside /etc? Or that it could
> be done in some other ways.
>
> Thanks.
>
You can use the core.worktree config variable in order to specify a
worktree (/etc) which is not directly above .git. For your git commands
to find the .git dir you would need to set GIT_DIR or use the --git-dir
parameter.
I have found, though, that several git commands require you to be within
the worktree or else they become confused. I use a shell function for
that, doing something like "gg ~/path/project log" which requires
~/path/project.git to have its core.worktree set. Also, having a git
alias like "git view" set up for gitk helps calling gitk in that way.
git-gui makes unfounded assumptions and is completely unhappy in a
situation like that.
I think the situation around GIT_DIR and and worktree is a bit in the
flux at the moment (panta rhei..) but it works for me.
Cheers,
Michael
Here's the "git go" bash function. I'm not proud of it, it makes several
assumptions and does no error checking. Use it like "gg path/project
command parameters" if the git-dir is "path/project.git" or "gg
path/project/" if the git-dir is "path/project/.git". Have your
core.worktree set in the former case, and also in the latter if the
worktree is not "path/project".
I'm sure it can be done much better using helper functions from git's
bash-completion, e.g.
gg ()
{
local _gg="$1";
shift;
local _ggwt=`git --git-dir="${_gg}.git" config --get core.worktree`;
if [ -z "${_ggwt}" ]; then
_ggwt=$(cd ${_gg} 2> /dev/null && pwd -P);
fi;
local _gggd=$(cd ${_gg}.git 2> /dev/null && pwd -P);
pushd ${_ggwt} > /dev/null;
git --git-dir=${_gggd} "$@";
popd > /dev/null
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: how to git a read only directory
2009-01-21 8:33 how to git a read only directory bill lam
2009-01-21 9:57 ` Michael J Gruber
@ 2009-01-21 12:34 ` Boaz Harrosh
2009-01-21 15:52 ` bill lam
1 sibling, 1 reply; 10+ messages in thread
From: Boaz Harrosh @ 2009-01-21 12:34 UTC (permalink / raw)
To: git
bill lam wrote:
> I want to use git to keep track of files inside /etc but do not want
> to do it as a super user. Is that possible to put GIT_DIR under my
> home directory and add public-read files inside /etc? Or that it could
> be done in some other ways.
>
> Thanks.
>
I did the really easy hack (on my /etc BTW) and it worked fine for me.
I created a master project folder under ~home, init a new git repo,
then symlink /etc/ onto an etc/ in the project dir, added all etc/
files. I like the extra a/etc/fstab in the patch files better then
a/fstab.
And it is a life saver, payed it's effortless in gold. Some shining
new distro should come up with a git based management system
and it will leave all the other distros in the dust.
Cheers
Boaz
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: how to git a read only directory
2009-01-21 9:57 ` Michael J Gruber
@ 2009-01-21 15:48 ` bill lam
0 siblings, 0 replies; 10+ messages in thread
From: bill lam @ 2009-01-21 15:48 UTC (permalink / raw)
To: Michael J Gruber; +Cc: git, cbill.lam
On Wed, 21 Jan 2009, Michael J Gruber wrote:
> You can use the core.worktree config variable in order to specify a
> worktree (/etc) which is not directly above .git. For your git commands
> to find the .git dir you would need to set GIT_DIR or use the --git-dir
> parameter.
Michael, thanks for pointing out worktree being the trick to use.
--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩267 王翰 涼州詞
葡萄美酒夜光杯 欲飲琵琶馬上催 醉臥沙場君莫笑 古來征戰幾人回
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: how to git a read only directory
2009-01-21 12:34 ` Boaz Harrosh
@ 2009-01-21 15:52 ` bill lam
2009-01-21 16:46 ` Boaz Harrosh
0 siblings, 1 reply; 10+ messages in thread
From: bill lam @ 2009-01-21 15:52 UTC (permalink / raw)
To: Boaz Harrosh; +Cc: git
On Wed, 21 Jan 2009, Boaz Harrosh wrote:
> I created a master project folder under ~home, init a new git repo,
> then symlink /etc/ onto an etc/ in the project dir, added all etc/
> files. I like the extra a/etc/fstab in the patch files better then
> a/fstab.
I create a symlink in ~/gitrepo/etc to /etc and git init an empty repo
there. However it failed in symlink when I tried to add files. Could
you give more detail how to do it? Meanwhile I use worktree method as
suggested by Michael.
--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩205 元稹 遣悲懷三首之一
謝公最小偏憐女 自嫁黔婁百事乖 顧我無衣搜藎篋 泥他沽酒拔金釵
野蔬充膳甘長藿 落葉添薪仰古槐 今日俸錢過十萬 與君營奠復營齋
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: how to git a read only directory
2009-01-21 15:52 ` bill lam
@ 2009-01-21 16:46 ` Boaz Harrosh
2009-01-22 10:00 ` bill lam
0 siblings, 1 reply; 10+ messages in thread
From: Boaz Harrosh @ 2009-01-21 16:46 UTC (permalink / raw)
To: Boaz Harrosh, git
bill lam wrote:
> On Wed, 21 Jan 2009, Boaz Harrosh wrote:
>> I created a master project folder under ~home, init a new git repo,
>> then symlink /etc/ onto an etc/ in the project dir, added all etc/
>> files. I like the extra a/etc/fstab in the patch files better then
>> a/fstab.
>
> I create a symlink in ~/gitrepo/etc to /etc and git init an empty repo
> there. However it failed in symlink when I tried to add files. Could
> you give more detail how to do it? Meanwhile I use worktree method as
> suggested by Michael.
>
What? I don't know this is what I did:
[~] $ mkdir gitrepo; cd gitrepo
[gitrepo] $ git-init
[gitrepo] $ ln -s /etc
[gitrepo] $ git-add /etc/fstab
[gitrepo] $ git-commit -s
Edit commit message in editor
[gitrepo] $ git-show
commit fd6a4a72bf91526b56528f4036c525f6d6fd3dc0
Author: Boaz Harrosh <bharrosh@panasas.com>
Date: Wed Jan 21 18:36:58 2009 +0200
{REMOVEME} etc/fstab test
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
diff --git a/etc/fstab b/etc/fstab
new file mode 100644
index 0000000..2e3f8d3
--- /dev/null
+++ b/etc/fstab
@@ -0,0 +1,18 @@
+LABEL=/fc7 / ext3 noatime 1 1
+LABEL=/usr0 /usr0 ext3 noatime 1 2
+LABEL=/boot /boot ext2 noatime 1 2
+LABEL=/fc10 /alt ext3 defaults 1 2
+tmpfs /dev/shm tmpfs defaults 0 0
+devpts /dev/pts devpts gid=5,mode=620 0 0
+sysfs /sys sysfs defaults 0 0
+proc /proc proc defaults 0 0
+LABEL=SWAP-sda7 swap swap defaults 0 0
+panstor:/main /mnt/panstor nfs soft,intr,rsize=65536,wsize=65536 0 0
<... snip ...>
So in short I did nothing. I have git 1.6.0.1
Boaz
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: how to git a read only directory
2009-01-21 16:46 ` Boaz Harrosh
@ 2009-01-22 10:00 ` bill lam
2009-01-22 10:19 ` Boaz Harrosh
0 siblings, 1 reply; 10+ messages in thread
From: bill lam @ 2009-01-22 10:00 UTC (permalink / raw)
To: Boaz Harrosh; +Cc: git
On Wed, 21 Jan 2009, Boaz Harrosh wrote:
> [~] $ mkdir gitrepo; cd gitrepo
> [gitrepo] $ git-init
> [gitrepo] $ ln -s /etc
> [gitrepo] $ git-add /etc/fstab
(I use git ver. 1.6.1, git-xxx is already deprecated)
I followed your example, and failed in the git add,
gitrepo$ git add /etc/fstab
fatal: '/etc/fstab' is outside repository
--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩260 李益 江南曲
嫁得瞿塘賈 朝朝誤妾期 早知潮有信 嫁與弄潮兒
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: how to git a read only directory
2009-01-22 10:00 ` bill lam
@ 2009-01-22 10:19 ` Boaz Harrosh
2009-01-22 10:29 ` bill lam
0 siblings, 1 reply; 10+ messages in thread
From: Boaz Harrosh @ 2009-01-22 10:19 UTC (permalink / raw)
To: Boaz Harrosh, git
bill lam wrote:
> On Wed, 21 Jan 2009, Boaz Harrosh wrote:
>> [~] $ mkdir gitrepo; cd gitrepo
>> [gitrepo] $ git-init
>> [gitrepo] $ ln -s /etc
>> [gitrepo] $ git-add /etc/fstab
>
Sorry My mistake, it should be:
[gitrepo] $ git-add etc/fstab
> (I use git ver. 1.6.1, git-xxx is already deprecated)
> I followed your example, and failed in the git add,
>
> gitrepo$ git add /etc/fstab
> fatal: '/etc/fstab' is outside repository
>
Sorry it's a typo, sure you must add files relative to
the base directory (one containing the .git/ dir)
Cheers
Boaz
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: how to git a read only directory
2009-01-22 10:19 ` Boaz Harrosh
@ 2009-01-22 10:29 ` bill lam
2009-01-22 12:35 ` Boaz Harrosh
0 siblings, 1 reply; 10+ messages in thread
From: bill lam @ 2009-01-22 10:29 UTC (permalink / raw)
To: Boaz Harrosh; +Cc: git
On Thu, 22 Jan 2009, Boaz Harrosh wrote:
> Sorry My mistake, it should be:
> [gitrepo] $ git-add etc/fstab
>
> Sorry it's a typo, sure you must add files relative to
> the base directory (one containing the .git/ dir)
Hi Boaz,
I still could not add the file. This time it said symbolic link error.
gitrepo$ ll -A
total 4
lrwxrwxrwx 1 bill bill 4 2009-01-22 17:54 etc -> /etc
drwxr-xr-x 7 bill bill 4096 2009-01-22 18:23 .git
gitrepo$ pwd
/home/bill/gitrepo
gitrepo$ git add etc/fstab
fatal: 'etc/fstab' is beyond a symbolic link
--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩314 王昌齡 長信怨
奉帚平明金殿開 且將團扇共徘徊 玉顏不及寒鴉色 猶帶昭陽日影來
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: how to git a read only directory
2009-01-22 10:29 ` bill lam
@ 2009-01-22 12:35 ` Boaz Harrosh
0 siblings, 0 replies; 10+ messages in thread
From: Boaz Harrosh @ 2009-01-22 12:35 UTC (permalink / raw)
To: Boaz Harrosh, git
bill lam wrote:
> On Thu, 22 Jan 2009, Boaz Harrosh wrote:
>> Sorry My mistake, it should be:
>> [gitrepo] $ git-add etc/fstab
>>
>> Sorry it's a typo, sure you must add files relative to
>> the base directory (one containing the .git/ dir)
>
> Hi Boaz,
>
> I still could not add the file. This time it said symbolic link error.
>
OK so it looks like it is something new. Good to know I will not
upgrade for now as I do use it a lot. Unless there is some config
nub that can be turned. I must say that it is most useful, I use
it everyday.
Someone please comment why are symlink not allowed. Is that because
it might be dangerous? but so is a gun I might shoot myself in the
leg, but they are still been sold.
Boaz
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2009-01-22 12:36 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-21 8:33 how to git a read only directory bill lam
2009-01-21 9:57 ` Michael J Gruber
2009-01-21 15:48 ` bill lam
2009-01-21 12:34 ` Boaz Harrosh
2009-01-21 15:52 ` bill lam
2009-01-21 16:46 ` Boaz Harrosh
2009-01-22 10:00 ` bill lam
2009-01-22 10:19 ` Boaz Harrosh
2009-01-22 10:29 ` bill lam
2009-01-22 12:35 ` Boaz Harrosh
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.