简体   繁体   English

通过SSH向所有人的ubuntu服务器上的git共享存储库

[英]git share repository on ubuntu server over ssh to everyone

I initially had an svn repository on my ubuntu server. 我最初在ubuntu服务器上有一个svn存储库。 I have now converted that into a git repository using git svn. 我现在已经使用git svn将其转换为git存储库。 I now have a .git directory under ~/csmart/git/csmart. 我现在在〜/ csmart / git / csmart下有一个.git目录。

I would like all my colleagues now to start cloning this remote repository as their base and then start working on it. 我希望所有同事现在都开始克隆此远程存储库作为他们的基础,然后开始进行操作。 So effectively they would have all switched from svn on to git. 如此有效地将它们全部从svn切换到git。

Now the question is how do I share that remote repository with everyone. 现在的问题是如何与所有人共享该远程存储库。

Things I tried: 我尝试过的事情:

1. On the directory ~/csmart/git/csmart I added a remote with the following command: 1.在〜/ csmart / git / csmart目录中,使用以下命令添加了一个遥控器:

git remote add csmart ssh://csmartserver/~/csmart/git/csmart/csmart.git

On my local computer I tried to clone the repository with url: 在我的本地计算机上,我尝试使用url克隆存储库:

git clone ssh://csmartserver/~/csmart/git/csmart/csmart.git

I get an error saying ~/csmart/git/csmart/csmart.git is not a git repository 我收到一条错误消息,说〜/ csmart / git / csmart / csmart.git不是git存储库

2. I tried to create a bare repository on another directory on the server. 2.我试图在服务器上的另一个目录上创建一个裸仓库。 I then tried to push the repo under home/sethu/csmart/git/csmart/csmart.git to there ... 然后我尝试将home / sethu / csmart / git / csmart / csmart.git下的回购推送到那里...

sethu@csmartserver:/data/csmart/git-repositories/csmart$ git --bare init
sethu@csmartserver:~/csmart/git/csmart$ git remote add origin ssh://localhost/data/csmart/git-repositories/csmart
sethu@csmartserver:~/csmart/git/csmart$ git push origin master
sethu@localhost's password: 
error: src refspec master does not match any.
error: failed to push some refs to 'ssh://localhost/data/csmart/git-repositories/csmart'

My idea was to create the bare repository and share the git repo using that and discard the ~/csmart/git/csmart repo. 我的想法是创建裸仓库并使用该仓库共享git repo并丢弃〜/ csmart / git / csmart repo。 But I was getting errors as show above. 但如上所述,我遇到了错误。 It says the master does not match. 它说主人不匹配。 That kinda of makes sense. 这样有点道理。 Does creating a bare repository create a branch with an alias master? 创建裸存储库是否会创建具有别名母版的分支?

How do I share the git repo that I have created using svn. 如何共享使用svn创建的git repo。

First, do try gitolite as it will take care of administering lots of users easily. 首先,请尝试使用gitolite,因为它将轻松管理大量用户。

Make sure that you have ssh connections enabled in Ubuntu - it's not possible with a default install. 确保已在Ubuntu中启用ssh连接-默认安装无法实现。 Next, ensure that you have the proper file and folder permissions. 接下来,确保您具有适当的文件和文件夹权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM