bower registering local git package

How can I register a local git package in bower?

My current component.json is as follows

  • AngularJs: Show version number from either git or bower
  • Bower refuses to install from github fork
  • Bower - Give different path to a registered package
  • .gitignore: ignore alle dist folders except the ones in bower_components
  • Angular-route bower download issue
  • Should bower_components be publicly accessible to get the benefit of sourcemaps?
  • {
      "name": "myproject",
      "version": "1.0.0",
      "dependencies": {
        "jquery": "1.8.0",
        "twitter/bootstrap": "2.1.1"

    However I also would like to add a package I have created at C:/mypackage which is a git repository with versions tagged.
    When I do bower install --save C:/mypackage it properly adds it to project but it doesn’t add it to my component.json.

    I am trying bower register mypackage C:/mypackage but it keeps giving me

    bower error Incorrect format

    What am I doing wrong?

  • gem install git-up no longer working in El Capitan
  • what logic does git follow to determine that remote contains work not available in local repository
  • Mercurial “submodule” inside a Git repository
  • Can git submodule update be made to fetch tags in submodules?
  • GitLab reconfigure Error: executing action `create` on resource 'user'
  • TSLint pre-commit hook
  • 4 Solutions collect form web for “bower registering local git package”

    Option 1: Public Bower registration

    Bower is built mostly to share public (client-side) code in a “non-opinionated” manner. The primary use case, then, is to have a publicly accessible repository (on GitHub) that is registerd with a name and git repository url. I just did this myself:

    bower register linksoup git://

    This is just telling the bower server that when you install linksoup to go and grab the code at the git:// repository, and put it in the local project’s component directory.

    If this is what you want to do, then just set up a repository on github/etc., push your code there, and then register with the resulting repository info.

    Option 2: Private dependency

    There are many reasons not to post your code at a publicly accessible repository. It may not be open source, etc. if your mypackage code is not meant to be public, then you should probably not be registering it on the public bower server… Further, even if you could register a local directory, it would only work on your machine…which defeats the purpose of sharing the code via bower.

    If you just want to have bower manage a local, private dependency, then I am going to riff off of blockhead’s solution:

      "name": "myproject",
      "version": "1.0.0",
      "dependencies": {
        "jquery": "1.8.0",
        "twitter/bootstrap": "2.1.1",
        "mypackage": "file:///path/to/mypackage/.git"

    This is just saying that myproject needs mypackage, and to use git clone to retrieve it. My guess is that this can use anything git can understand (including local repositories). But you should note that this may run into problems for anyone else working on this code that cannot access your local path.

    Best Guess

    It looks to me as if you may have assumed that bower register was a local operation (telling bower how to find a dependency via some sort of local registry). As far as I can tell, this is only a remote and public registration, which is why this is unsupported.

    You may also be looking for a way to do something like a link operation with npm. That is, work on a dependency module without always having your dev cycle include a publish.

    A little detail about how many people are involved and what you were trying to accomplish would facilitate a more targeted answer.

    You can add any git repository as follows:

      "name": "myproject",
      "version": "1.0.0",
      "dependencies": {
        "jquery": "1.8.0",
        "twitter/bootstrap": "2.1.1",

    You can use bower link:

    The link functionality allows developers to easily test their packages.
    Linking is a two-step process.

    Using ‘bower link’ in a project folder will create a global link.
    Then, in some other package, ‘bower link ‘ will create a link in the components folder
    pointing to the previously created link.

    This allows to easily test a package because changes will be reflected immediately.
    Please note that bower will not fetch the linked package dependencies.

    Bower will overwrite the link when installing/updating.

    The big idea with bower is to easily share your projects’ dependencies. So using local repo should be limited to testing.

    Once you understand that, you should know that it is not –strictly– necessary to register your package in order to use it as a dependency.

    This is due to the fact that bower depencency can specify either a version, a folder or a package. So you can use local repository.

    Define as bower package

    First you will need to define your dependency as a bower package:

    # create the bower package
    cd /path/to/you-need-me
    bower init
    # answer questions…

    Add as project dependency

    Then in your main project, the one that need the you-need-me dependency, edit bower.json file to add (or expand):

      "dependencies": {
        "you-need-me":  "file:///path/to/you-need-me/.git/"
        "you-need-me-windows":  "C:/path/to/you-need-me-windows/.git/"

    So you don’t give a version, but an local git endpoint, i.e. the subdirectory .git/.

    Install dependency

    In the man project install bower dependencies with:

    cd /path/to/main-project/
    bower install


    bower you-need-me#*              ENOTFOUND Package /path/to/you-need-me/ not found

    Check again your path and that you point to the .git/ directory of your dependency.


    You should get something like:

    bower you-need-me#*             not-cached file:///path/to/you-need-me/.git/#*
    bower you-need-me#*                resolve file:///path/to/you-need-me/.git/#*
    bower you-need-me#*               checkout master
    bower you-need-me#*               resolved file:///path/to/you-need-me/.git/#b18c753c6f
    bower you-need-me#*                install you-need-me#b18c753c6f

    Write a blog entry about that: Testing bower.json locally before registering package.

    Git Baby is a git and github fan, let's start git clone.