# How do you add an external directory to repository?

3 messages from 2010-03-07 to 2010-03-07. Participants: slipstream180, Fredrik Gustafsson, Nicolas Sebrecht.
Thread: https://gitlist.dev/t/22945

## slipstream180, 2010-03-07 20:03

Subject: How do you add an external directory to repository?
Message-ID: <1267992229319-4691734.post@n2.nabble.com>
URL: https://gitlist.dev/e/1267992229319-4691734.post%40n2.nabble.com

```

I want to add an external directory to an existing repository.

External Dir: /home/some/directory

Working Dir: /htdocs/.git

If I attempt the following command from the /htdocs dir:

git add /home/some/directory

I get an error: fatal: '/home/some/directory' is outside repository

I understand that I can add a symbolic link to /home/some/directory, but I
believe that only track the link. How do I track all files under the
directory as well?

Thanks in advance!

-- 
View this message in context: http://n2.nabble.com/How-do-you-add-an-external-directory-to-repository-tp4691734p4691734.html
Sent from the git mailing list archive at Nabble.com.

```

## Fredrik Gustafsson, 2010-03-07 20:23

Subject: Re: How do you add an external directory to repository?
Message-ID: <20100307202302.GB19693@iveqy.com>
URL: https://gitlist.dev/e/20100307202302.GB19693%40iveqy.com
In-Reply-To: <1267992229319-4691734.post@n2.nabble.com>

```
On Sun, Mar 07, 2010 at 12:03:49PM -0800, slipstream180 wrote:
> 
> I want to add an external directory to an existing repository.
I'm unsure if that can be done, I don't think so.

I do, however, believe that the superproject functionality can suite
your needs. Then you will have two git repositories, one wich is
handling the other.

It sounds really more complicated than it is.

http://en.wikibooks.org/wiki/Git/Submodules_and_Superprojects

regards
iveqy

```

## Nicolas Sebrecht, 2010-03-07 21:36

Subject: Re: How do you add an external directory to repository?
Message-ID: <20100307213624.GA12937@vidovic>
URL: https://gitlist.dev/e/20100307213624.GA12937%40vidovic
In-Reply-To: <1267992229319-4691734.post@n2.nabble.com>

```
The 07/03/10, slipstream180 wrote:

> I understand that I can add a symbolic link to /home/some/directory, but I
> believe that only track the link. How do I track all files under the
> directory as well?

I think you're looking for the bind option of mount. This is what I use
to track all my configuration files in one "conf" repository.

Here is an extract of how my fstab looks like:

  /home/nicolas/.zsh /home/nicolas/dev/conf/zsh				auto	bind,user	0 0 
  /home/nicolas/.vim /home/nicolas/dev/conf/vim				auto	bind,user	0 0 
  /home/nicolas/.mutt /home/nicolas/dev/conf/mutt				auto	bind,user	0 0 
  /home/nicolas/.screen /home/nicolas/dev/conf/screen			auto	bind,user	0 0 
  /home/nicolas/.offlineimapconf/ /home/nicolas/dev/conf/offlineimap	auto	bind,user	0 0 

I also use a symbolic link ~/.zshrc to .zsh/zshrc to track it too. This
is very useful because one logical change may affect configuration files
from various programs (e.g. have a new mailbox concerns mutt,
offlineimap, imapfilter, and some other scripts of my own).


Also, I use this trick for web projects:

  /home/nicolas/dev/wsb /var/www/localhost/htdocs/wsb			auto	bind,user	0 0
  

-- 
Nicolas Sebrecht

```
