Configuring ssh with Git
I did the 开发者_C百科following,
- Created one account for Git
- Created bare repository
- Using ssh-keygen -t rsa command i create public key for two account(one is git account), K
- added both public key(located in /home/user/.ssh/id_rsa.pub) under authorized_keys in .ssh directory(git account).
- Cloned the repository by two account
- Git account is able to push the changes to server (it is asking passpharse)
- for another account it is not allowing to push the change, not asking passpharse asking password.
What could be the problem ?
This is the output:
git push origin master
Offending key for IP in /home/user01/.ssh/known_hosts:15
Matching host key in /home/user01/.ssh/known_hosts:51
Are you sure you want to continue connecting (yes/no)? yes
user01@gitserver's password: Counting objects: 2, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 317 bytes, done.
Total 2 (delta 1), reused 0 (delta 0)
error: insufficient permission for adding an object to repository database ./objects
fatal: failed to write object error: unpack failed: unpack-objects abnormal exit
If I understand what you're asking at all (it's a bit vague), you're having trouble setting up a shared git repo, where multiple users should have access?
I assume this is a linux/unix/bsd server of some sort?
What I've done in our company is that we have all have a user on the server with a bare repository in our home folder (used as private public mirror of our working repo). And we have a separate user called "git" that are member of the group also called "git", with a bare repo to serve as a sort of canonical common repo. All developers are also in the "git" group and the git repo is shared with the group. (Our private repos in our home all the others have only read acces so they can pull but we can git push --mirror to it without problems.)
The ssh config is per user and I access the common repo using this remote:
[remote "commonRepo"]
url = ssh://<myUserName>@testServerName/~git/commonRepo.git
fetch = +refs/heads/*:refs/remotes/commonRepo/*
The specifics about configuring public keys I don't remember as I do it only every 3 years or so... But we don't have any ssh keys connected to the "git" user we use our own ssh keys for our own user, and rely on the group permissions in Linux to get access to the common repo.
Make sure the sicky bits (or what it's callel) is properly set on the server so that when pushing to the common repo the owner is not changed (that causes all sorts of stange errors)
精彩评论