views:

54

answers:

1

I'm working deploying rails applications.

I setup Gitosis on my server. Git user is up and I'm already have 'deploy' user on the server! I was 'git clone' to my local machine from the deploy user on the server. After setting up Gitosis, I'm also able to 'git clone' from the server(git user).

What I want is to 'git clone' from 'git clone' inside the server from 'git' user to 'deploy' user!

and here the problem in a picture: http://bit.ly/90Spxg

I'm already know that this issue is in ssh permission etc. because when I try to 'git clone' on deploy user I got

Initialized empty Git repository in /home/deploy/some_folder/.git/
The authenticity of host '[178.xx.xx.xx]:30000 ([178.xx.xx.xx]:30000)' can't be established. 
RSA key fingerprint is dc:f3:53:35:xx:xx:xx:f7:62:4c:e3:68:7e:70:46:cb. 
Are you sure you want to continue connecting (yes/no)? ( MY ANSWER yes )
Failed to add the host to the list of known hosts (/home/deploy/.ssh/known_hosts). 
[email protected]'s password:

Please let me know what I have to do to figure out this issue!

Thanks in advance!

+1  A: 

This is probably not a git problem, but an ssh issue. You should be able to replicate the same problem by trying to ssh to the git server (which is localhost). More than likely, the folder ~/.ssh (or ~/.ssh/known_hosts) permissions are incorrect (the disk may be full, or there may be some file system corruption as well, but those are highly unlikely).

If you don't have any important data in there, you can try removing ~/.ssh, and letting ssh rebuild it on your next ssh (or git) attempt to localhost.


Having said that, I remember now that gitosis uses certificates for user authentication. Your .ssh should have an id_rsa and id_rsa.pub. Make sure you save them if they are kept in the local host.

Also make sure you've registered the deploy user's certificate to gitosis, and allowed access to the repository in gitosis.conf. The ssh stage asking for password means that your private key is not being used for authentication for some reason.

Dysaster
Thanks for the answer. But i cant get it so clear.what i have on server is git and deploy user! i can push from the my local machine to both of them. but the problem is when i try to clone from the git user to the deploy. i want the flow of how to let deploy access git's repo on the git user "that gitosis made"
amrnt
It looks like your gitosis setup does not recognize the 'deploy' user. I suggest reading the document http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way, especially the section on adding a new user. Gitosis determines the user who is trying to access the repositories according to their certificates (actually their private keys), and the fact that your clone command is asking for a password indicates that 'deploy' user cannot authenticate using the private key (or it is not accepted).
Dysaster
By the way, if you want to cheat, you can always go behind gitosis, and clone the repository directly, using "git clone ~git/repositories/xxx.git" - assuming deploy has read access to the directory.
Dysaster
"if you want to cheat..." I tried this but it requires user password.. and finally it gives "access denied"!and about the article! I will apply the stuff again! let me try for the fifth time!
amrnt
If you already have .ssh/id_rsa and .ssh/id_rsa.pub in deploy's home directory, and if you've already completed the steps in the "Adding users" section with this id_rsa.pub as deploy.pub, then the only thing that could be missing is a "git push" on the gitosis-admin clone you are working on.To validate deploy is registered, check (as root) ~git/.gitosis.conf and make sure it contains your changes, and check ~git/.ssh/authorized_keys and make sure your deploy's public key is in this file.Also double check (as deploy), that ~/.ssh and its contents belong to deploy, and can be read.
Dysaster
We are so near! I thought about these steps! But when i want to generate ssh key on deploy user it require sudo.. and then you'll find the keys made in /root/.ssh folder not deploy!For me this is the lost circle!
amrnt
It looks like my initial assessment was true, then. Check owner of /home/deploy/.ssh and its contents, and either remove the whole directory as root, and start over as deploy, or give ownership back to deploy.Also, is this still stackoverflow material, or should it move to serverfault?
Dysaster
maybe its serverfault issue now! Well, thanks for help
amrnt
what i did is that, first when I installed gitosis, i added ssh key of the other user on the server, then i added my local user and it works now! Thank you for some notes!
amrnt