最佳答案
我需要创建一个名为carboncake
的回购。
我试了一下:
将gitosis-admin存储库克隆到本地机器
$ git clone gitosis@myserver.net:repositories/gitosis-admin.git
$ cd gitosis-admin
$ vim gitosis.conf
将[repo carboncake]
和[group carboncake]
部分添加到文件的末尾
[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 = myappname
members = mithun @core
然后复制由Putty生成的pub密钥文件(我使用Git basg for Windows):
$cp /some/where/mithun.pub keydir/mithun.pub
执行如下命令:
$ git add gitosis.conf keydir/mithun.pub
$ git commit -m "Added 'carboncake' repository and 'mithun' user."
$ git pull --rebase
$ git push
但它不会产生任何碳饼。git在我的服务器。
所以我就这么做了:
在服务器端执行如下命令:
$ su gitosis
$ git init --bare /srv/gitosis/repositories/carboncake.git
我的问题是:
我尝试从本地机器签出/克隆新的存储库
$ mkdir carboncake
$ cd carboncake
$ git init
$ touch a_text_file.txt
$ git add a_text_file.txt
$ git remote add origin gitosis@myserver.net:repositories/carboncake.git
$ git push origin master
返回错误:
error: src refspec master does not match any.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'gitosis@myserver.net:repositories/carboncake.git'
当我尝试git push origin HEAD:master
时,它返回错误:
error: src refspec HEAD does not match any.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'gitosis@myserver.net:repositories/carboncake.git'
当我尝试git push origin master:refs/heads/master
时,它返回错误:
error: src refspec master does not match any.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'gitosis@myserver.net:repositories/carboncake.git'
本地机器上的git show-ref
不显示任何东西
另外,服务器上的/srv/gitosis/repositories/carboncake.git/refs/heads/
目录是空的。
我该如何解决这个问题?