gitosis和git clone问题 [英] gitosis and git clone problem

查看:161
本文介绍了gitosis和git clone问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了gitosis,但当我使用回购协议时,我有些奇怪。
在配置中我有

  [gitosis] 

[group gitosis-admin]
可写= gitosis-admin
成员=我@服务器我@笔记本

[组prj1]
可写= prj1
成员=我@笔记本

和/ home / git / repositories我已经创建了目录prj1.git,其中包含空的git repo。



我可以在服务器和笔记本电脑上使用gitosis-admin而没有任何问题,但是当我尝试在笔记本电脑上 clone prj1时, p>

  $ git clone git @ server:prj1.git 
/ Users / alec / temp / prj1 / .git /
致命:没有匹配的远程主机

ok,让prj1从笔记本电脑到服务器:

$ $ p $ code $ git push origin master:refs / heads / master
ERROR:gitosis.serve.main:Repository读访问被拒绝
致命:远程终端意外挂起

什么错误?

解决方案

以下是在你的笔记本电脑上完成的,解决了这个问题吗?

而不是git clone:

  mkdir prj1 
cd prj1
git init
touch README
git add。
git commit -m添加空白自述文件
git remote add origin git @ server:prj1.git
git push origin master

ebneter 在评论中添加了内容:


您可能会提及这个原因的原因是您无法克隆空的回购

(正如我的用户经常发现的那样...


这提醒了OP的问题:


...和 / home / git / repositories 我已经创建了目录prj1.git with empty git repo


这并不是理想的选择。

This SO问题提到了克隆空回购的问题: p>


换句话说,不要试图克隆空的回购,而是在创建它之后,推送一个包含一个无害文件的简单回购。然后它不再是空的并且可以克隆。






从那以后, Chris Johnsen 评论:


任何超过1.6.2的Git


(实际上自2009年3月以来)



< blockquote>

可以克隆空的存储库。

(scare引号,因为它实际上只是进行正常的初始化和设置远程设备,并为推测的最终主设备创建跟踪配置科)。



I have installed gitosis, but i have strange thing when i'm working with repos. In config i have

[gitosis]

[group gitosis-admin]
writable = gitosis-admin
members = me@server me@laptop

[group prj1]
writable = prj1
members = me@laptop

and in /home/git/repositories i have created directory prj1.git with empty git repo.

i can work with gitosis-admin from server and laptop without problems, but when i'm trying to git clone prj1 on my laptop i see

$ git clone git@server:prj1.git
Initialized empty Git repository in /Users/alec/temp/prj1/.git/
fatal: no matching remote head

ok, lets push prj1 from laptop to server:

$ git push origin master:refs/heads/master
ERROR:gitosis.serve.main:Repository read access denied
fatal: The remote end hung up unexpectedly

Whats wrong?

解决方案

Would the following, done on your laptop, solve this issue?
Instead of a git clone:

  mkdir prj1
  cd prj1
  git init
  touch README
  git add .
  git commit -m "Added blank readme"
  git remote add origin git@server:prj1.git
  git push origin master

ebneter adds in the comment:

You might mention that the reason this works is that you can't clone an empty repo.
(As my users regularly discover...

And that reminds the OP question:

... and in /home/git/repositories I have created directory prj1.git with empty git repo

which is not ideal right there.
This SO question mentions the issue of cloning an empty repo:

In other words, don't attempt to clone the empty repo, but rather after creating it, push to it a simple repo containing one innocuous file. Then it is no longer empty and can be cloned.


Since then, Chris Johnsen comments:

Any Git later than 1.6.2

(so actually since March 2009)

can "clone" empty repositories.
(scare quotes because it really just amounts normal initialization plus setting up a remote, and creating a tracking configuration for the presumed, eventual master branch).

这篇关于gitosis和git clone问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆