Tag: bower

  • Quick Tip: Install a specific Git Repository Branch/SHA Hash with Bower

    Quick Tip: Install a specific Git Repository Branch/SHA Hash with Bower

    The other day I had to hotfix ngQuill, a nice angular.js wrapper for the quill.js editor. A variable with an initial value prevented Copy & Paste events in our project and I couldn’t wait to get my pull request merged into the original github repository as we had to release a working version.

    As a workaround I tried to do a bower install with the latest commit (or SHA hash) of my forked repository. As my fork is not published on bower, I used the entire URL to install the bower package and ended up with the following error:

    bower ENORESTARGET URL sources can't resolve targets

    The Fix: https:// VS. git://

    Try to replace the prefix “https:” and instead use “git:” for the repository and it will work.

    Branch works with git://

    bower install 'git://github.com/Cordobo/ngQuill#develop' --save

    SHA Hash works with git://

    bower install 'git://github.com/Cordobo/ngQuill#2f33302' --save

    Both won’t work with https://

    bower install 'https://github.com/Cordobo/ngQuill#develop' --save
    bower install 'https://github.com/Cordobo/ngQuill#2f33302' --save

    If you used the --save-flag, your bower.json file has a new entry similar to this one:

    "ngQuill": "git://github.com/Cordobo/ngQuill#2f33302"

    If you know why it works with the prefix git and not with https, let me know in the comments.