无法将主人推送到git

时间:2011-04-21 08:57:57

标签: git

我按照Ubuntu Git Community Documentation

上的说明操作

成功在服务器A上完全安装了git-core和gitosis包

A# sudo apt-get -y install git-core gitosis
A# gitosis user's password is gitflux

初始化的gitosis
A# sudo -H -u gitosis gitosis-init < ~/keys/git-dsa-public2.key

现在检查本地机器上的gitosis-admin分支

B$ git clone gitosis@A:repositories/gitosis-admin.git

尝试通过编辑gitosis.conf

将新项目添加到存储库
[gitosis]

[group team]
writable = sweepshots
members = git_id_rsa

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

并将其提交回服务器。 [没有错误,但我不确定这是否正常]

A#cat /srv/gitosis/repositories/gitosis-admin.git/gitosis.conf

现在正在显示

[gitosis]

[group team]
writable = sweepshots
members = git_id_rsa

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

致力于第一个项目

 C$ mkdir sweepshots
 C$ cd sweepshots
 C$ git init
 C$ touch a_text_file.txt
 C$ git add .
 C$ git commit -a -m "Initial import"
 C$ git remote add origin gitosis@A:sweepshots.git

(也尝试git remote add origin gitosis@A:repositories/sweepshots.git

 C$ git push origin master 

我在这里收到错误

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

我错过了什么吗?

- 此处更新是服务器A的目录列表

root@testserver:~# cd /srv/gitosis/
root@testserver:/srv/gitosis# ls
git  gitosis  repositories
root@testserver:/srv/gitosis# ls gitosis
projects.list
root@testserver:/srv/gitosis# ls repositories/
gitosis-admin.git
root@testserver:/srv/gitosis# ls git
gitosis-admin.git
root@testserver:/srv/gitosis#

2 个答案:

答案 0 :(得分:1)

看起来您可能需要repo部分,如此网页所示:http://www.mantisbt.org/wiki/doku.php/mantisbt:gitosis_management#adding_a_new_repository

[repo sweepshots]
description = My sweepshots project.
owner = John Smith

[group sweepshots]
writable = sweepshots
members = git_id_rsa

答案 1 :(得分:1)

您的服务器上没有sweepshots.git存储库,因此没有存储库git可以推送到。你必须先创建一个:

su gitosis # make sure the repository has the correct permissions
mkdir /srv/gitosis/sweepshots.git
cd /srv/gitosis/sweepshots.git
git init --bare