Reputation: 2457
I wish to save my configuration in a git repository to deploy my configuration files on different machines easily.
One of the configuration files I wish to save is zsh. I use oh-my-zsh, which is in ~/.oh-my-zsh
in my home directory. This directory is a git repository. oh-my-zsh uses git to update itself. I added it as a git submodule, which is fine.
Inside ~/.oh-my-zsh/custom/plugins/
and ~/.oh-my-zsh/custom/themes/
are custom plugins and themes that are installed after the fact. Those directories are in the oh-my-zsh gitignore file. The plugins and themes I added are also git repositories.
I use a git bare repository in ~/repositories/dotfiles/
and an alias that sets the working directory for git to the home directory, so I can add all files that I want to the configuration.
alias config="git --work-tree=$HOME --git-dir=$HOME/repositories/dotfiles/'
The problem now is that I can not add the git repositories in ~/.oh-my-zsh/custom/
as submodules to the git repository which has the working directory set to ~
because
~/.oh-my-zsh/custom/themes/powerlevel10k$ config submodule add $HOME/.oh-my-zsh/custom/themes/powerlevel10k
The following path is ignored by one of your .gitignore files:
.oh-my-zsh/custom/themes/powerlevel10k
Use -f if you really want to add it.
/.oh-my-zsh/custom/themes/powerlevel10k$ config submodule add -f $HOME/.oh-my-zsh/custom/themes/powerlevel10k
Adding existing repo at '.oh-my-zsh/custom/themes/powerlevel10k' to the index
fatal: Pathspec '.oh-my-zsh/custom/themes/powerlevel10k' is in submodule '.oh-my-zsh'
Failed to add submodule '.oh-my-zsh/custom/themes/powerlevel10k'
if I try the same command in ~ then it will "clone the repository" to ~/powerlevel10k
and it will then add that as the submodule.
What can be done? I was thinking about moving the directories and then adding them as submodules in those new directories and then creating symlinks in oh-my-zsh. But I was hoping for something that could be done with a simple git clone and no additional setup to make it work.
Upvotes: 1
Views: 273