Search code examples
gitdotfiles

applying dotfiles after forking someone else's dotfiles github repo


I'm trying to manage my dotfile using git and found a good dotfile repo to use as a basis in https://mths.be/dotfiles. So I forked the https://mths.be/dotfiles repo to my github account. I'm trying to apply the dotfiles using symlinks to my home directory, but I can't seem to be able to do it.

I've done everything until "set -- -f; source bootstrap.sh" according to the read me file in https://mths.be/dotfiles. But I'm stuck and can't find a solution out of this. Apparently the bootstrap.sh doesn't seem to work properly neither.

Basically, to sum up, my questions are (as a newbie to github and managing dotfiles):

  • How do you apply the dotfiles in an another directory other than the home directory? (I hear you can use symlinks to do that...but how exactly?
  • There seems to be a problem in line 13 in https://github.com/mathiasbynens/dotfiles/blob/master/bootstrap.sh (if [ "$1" == "--force" -o "$1" == "-f" ]; then). When I try to source the bootstrap.sh, it says = not found. What's wrong?
  • What is the role of bootstrap.sh exactly?

    Many thanks.

    Below is the bootstrap.sh code

    #!/usr/bin/env bash
    
    cd "$(dirname "${BASH_SOURCE}")";
    
    git pull origin master;
    
    function doIt() {
        rsync --exclude ".git/" --exclude ".DS_Store" --exclude ".osx" \
        --exclude "bootstrap.sh" --exclude "README.md" --exclude "LICENSE-MIT.txt" -avh --no-perms . ~;
        source ~/.bash_profile;
    }
    
    if [ "$1" == "--force" -o "$1" == "-f" ]; then
        doIt;
    else
        read -p "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1;
        echo "";
        if [[ $REPLY =~ ^[Yy]$ ]]; then
            doIt;
        fi;
    fi;
    unset doIt;
    

  • Solution

  • You seem to be using zsh but the dotfiles repo you mention is not using zsh (you can see this by the absence of a .zshrc file)


    To use specific configurations you link those files (and the folders these configurations use) into your home folder. For example .vimrc

    $ cd ~
    $ ln -s /path/to/dotfiles/.vimrc .vimrc
    $ ln -s /path/to/dotfiles/.vim .vim
    

    First command will change directory into your home folder.

    Second command will create a symbolic link from the dotfiles repo .vimrc into your home folder

    Third command will link the the .vim folder (used in .vimrc) into your home folder


    To answer the third part of your question first (because the first two are yet to clarify) I will cite the README.md

    The bootstrapper script will pull in the latest version and copy the files to your home folder.

    I will add the other answers as they become more clear