Reputation: 2224
I am trying to setup my git workflow (to deploy automatically my node.js app when I push). I have tried multiple things and end up doing this : http://toroid.org/ams/git-website-howto
I managed to make this method work but I have one problem left : I am in the list of authorized_keys of my git and root users so I can login via SSH to these users. But when I do a git pull, my computer tries to ssh using its current user to the server. That means that it searches on my server a user which has the same login as my local one (which doesn't exist)
If I am logged locally as root, it connect as root to the distant server and works. Otherwise, it tries a user that doesn't exist there and doesn't work.
Not sure if I explained this well... Sorry if this is not. Anyway if anyone know how to fix this and make me able to use git without having to create a distant user for each people of my team it would be cool :) Oh and my client is OS X and server Ubuntu
Upvotes: 0
Views: 94
Reputation: 387557
I’m not entirely sure if I understood you correctly, but you can set the username directly when specifying the URL of the remote.
For example on most Git hosting sites, you are supposed to use the user git
when connecting via SSH. This allows them to create only a single user they have to maintain while putting all authorization details behind that.
So a usual remote URL on GitHub for example looks like this: [email protected]:user/repository
. This is the long form of ssh://[email protected]/user/repository
.
So when you set your remote, when cloning, or afterwards, just include your username there and Git will use it when connecting via SSH:
git clone git@myserver:/path/to/repository
Upvotes: 1