Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install a bower package using a private git server (SSH)?

EDIT: this guy do exactly the same with success, can't figure out why it's not working for me.

I've just installed git and setup permissions/SSH authentication with public/private key (Centos 6.5). I'm able to pull/push without problems using i.e.:

git clone [email protected]:projects/boilerplate-template 

Username is git, code placed in /home/git/projects, repository created with git --init --shared boilerplate-template.

How can I require boilerplate-template with Bower in another project?

I've tried with the following bower.json file without luck:

{     "name": "my/newproject",     "dependencies": {         "boilerplate-template": "git://code.organization.com:projects/boilerplate-template"     } } 

ECMDERR: Failed to execute "git ls-remote --tags --heads git://code.organization.com:projects/boilerplate-template, exit code 128 unable to lookup code.organization.com (port project)...

Sadly it fails because :project is not the port but the path. I've also tried with ssh:// instead of git://:

ENOTFOUND: Package ssh://code.organization.com:projects/boilerplate-template not found.

like image 465
gremo Avatar asked Jul 20 '14 18:07

gremo


People also ask

How do I install Bower components?

You can also create a bower. json file and define multiple packages name with or without version. Navigate to your project folder directory and run the command “bower install”. It will download and install all the packages in your bower_components folder.

Where does Bower install packages?

Installed packages will be placed in a bower_components directory. This is created in the folder which the bower program was executed. You can change this destination using the configuration options in a . bowerrc file.


2 Answers

Ok, found the solution here: Using Bower as the Package Management tool for Internal, Private Libraries. Simply remove git:// or ssh:// and add .git suffix:

"[email protected]:projects/boilerplate-template.git#~1" 
like image 97
gremo Avatar answered Sep 24 '22 00:09

gremo


Also, if you're using Github and Bower for a private repo you can create a .netrc file if you need to run bower install on a remote server.

e.g. You have a DO droplet and need to checkout a git repo that uses ssh keys, but needs to run bower install with some deps that are private. If you add the .netrc file to your remote machine you will be good to go for deploys/builds.

// .netrc where someToken is generated in Github under Personal access token machine github.com     login userName     password someToken 
like image 42
Scott Sword Avatar answered Sep 22 '22 00:09

Scott Sword