l0b0
l0b0

Reputation: 58808

Add .git/config to another Git repository

I've got a repository which contains most of my application settings. I'd like to add .git/config from a different repo and replace it with a symlink in the original repo, but Git complains:

error: Invalid path '[...]/.git/config'
error: unable to add [...]/.git/config to index
fatal: adding files failed

Note: I'm not trying to add this to the root directory of the settings repo, but in a subdirectory.

Upvotes: 2

Views: 1525

Answers (3)

ming_codes
ming_codes

Reputation: 2922

Why not just use git submodule? It does sounds like its what you're looking for: a project that contains other projects.

Upvotes: 0

artagnon
artagnon

Reputation: 3709

A symbolic link won't work here. You can set the GIT_CONFIG environment variable to point to your config file instead.

Upvotes: 1

Aristotle Pagaltzis
Aristotle Pagaltzis

Reputation: 117959

Just put those settings in your global .gitconfig so it will apply to all repositories on your system – and remove them from the local .git/config so they won’t override your changes in .gitconfig as your preferences change and you update that.

Upvotes: 0

Related Questions