tags:

views:

103

answers:

2

Because I don't want to spend +$12 for the simple-to-use github.com private hosting, I place a lot of my code libraries in small repositories on a shared hosting account. This allows me to have as many code repos as I want.

Since those repos don't take any resources to sit there I also put a couple very light sites on that account to maximize my usage. These sites actually use some of those same code repos as submodules of their projects.

So, I push/pull code for each repo and site over ssh. The sites themselves setting just a couple directives down also pull those submodules.

So I have a simplesite.tld project on my pc with a submodule that looks like this:

[submodule "modules/blog"]
        path = modules/blog
        url = [email protected]:~/git/modules/blog/

Then I push the code to the simplesite.tld and login to the shared host through SSH and update the simplesite.tld modules

git submodule update

But it asks me for my SSH password for the "user" in order to login and get the repo code. Which is just an annoyance since the repo is on the same server.

So is there a better submodule link that I can use that both foreign computers (like my PC) and projects in the same harddrive can both use?

+1  A: 

You could set up public key authentication over SSH to avoid having to type in your password each time.

mipadi
I did that for my PC and it works great. However, since I am already SSH'ed into the server and then request a repo over SSH from that same user I guess the server gets confused and asks for the password again. I'm not sure how I would setup a public key for the same user to access his own account.
Xeoncross
You can concatenate that user's public key (`~/.ssh/id_rsa.pub`) with his own authorized keys file (`~/.ssh/authorized_keys`).
mipadi
Never would have though of that.
Xeoncross
+1  A: 

You can probably use the basic HTTP transport for git to provide global read-only access to your repos (assuming that's ok), or, restrict access via .htaccess directives. That should work fine with most shared hosting accounts. That will let you use the same url in both places.

Or, alternatively, you could use something other than submodules (which I personally have found to be rather inadequate for many potential use cases). For example, I like mr. It fulfils a slightly different role than submodules, but it can probably be made to work.

pioto