且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Git身份验证 - 作为新用户提取

更新时间:2023-12-03 10:47:10

mithun@myserver.net



通过使用 mithun @ myserver.net ,你完全绕过gitosis,因为正确的url会涉及gitolite已经过去的' git '用户每个gitosis命令都会涉及同一个'git'用户: gitosis@myserver.net (假设这里是'gitosis'帐户)。



另外,您不必指定回购的完整路径:

  git remote add origin gitosis@myserver.net:carboncake.git 


The following set of commands worked correctly

$ mkdir carboncake
$ cd carboncake
$ git init
$ git remote add origin gitosis@myserver.net:repositories/carboncake.git 
$ git pull

But when i tried pull as a different user,

$ mkdir carboncake
$ cd carboncake
$ git init
$ git remote add origin mithun@myserver.net:repositories/carboncake.git 
$ git pull

I got the following error

fatal: 'repositories/carboncake.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

my gitosis.conf contains

[gitosis]

[group team]
writable = sweepshots
members = git_id_rsa

[group gitosis-admin]
writable = gitosis-admin
members = git_id_rsa


[repo carboncake]
description = A brand new app by Mithun.
owner = Mithun P

[group carboncake]
writable = carboncake
members = mithun @core

and the keydir contains git_id_rsa.pub KEY-----.pub mithun.pub mithun-rsa-key-20110427.pub

and the user's .ssh dir contains

mithun@testserver:~$ ls .ssh/
id_rsa  id_rsa.pub  mithun_rsa  mithun_rsa.pub

-- UPDATE

I tried $ git remote add origin mithun@myserver.net:carboncake.git too, but the same error.

Actually carboncake.git is located at /srv/gitosis/repositories/carboncake.git

mithun@myserver.net ?

By using mithun@myserver.net, you are bypassing gitosis completely, since the correct url would involve the 'git' user under which gitolite has been installed.
Every gitosis commands would involve the same 'git' user: gitosis@myserver.net (assuming a 'gitosis' account here).

Plus, you shouldn't have to specify the full path of the repo:

 git remote add origin gitosis@myserver.net:carboncake.git