• Home
  • Health
  • Software
  • Blog
  • git

    Git Subtrees

    Make one like this, creating an e.g. "modules" directory to clone files inside a modules directory from another repo:

    git subtree add --prefix modules git@bitbucket.org:something/something.git main --squash
    

    If it's still complaining about the directory not being a repository, e.g. this error:


    fatal: 'modules' does not appear to be a git repository
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    


    ...make sure this is in .git/config:

    [remote "modules"]
            url = git@bitbucket.org:something/something.git
            fetch = +refs/heads/*:refs/remotes/modules/*