Linux 如何创建 .git 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10306959/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to create .git file
提问by fred basset
My team has their repositories as .git files in various places on the filesystem, we don't use a git server. How do you create a .git file from existing sources?
我的团队在文件系统的不同位置将他们的存储库作为 .git 文件,我们不使用 git 服务器。如何从现有源创建 .git 文件?
采纳答案by Andy Ross
Simple answer:
简单回答:
cd my_source_dir
git init
git add .
git commit -m "initial commit"
Now your friends with access to the same filesystem can clone it with:
现在,您可以访问相同文件系统的朋友可以使用以下命令克隆它:
git clone /path/to/my_source_dir new_tree_name
回答by Yunx
I suppose that you mean "share using gitosis" http://www.jedi.be/blog/2009/05/06/8-ways-to-share-your-git-repository/#gitosis
我想你的意思是“使用 gitosis 共享” http://www.jedi.be/blog/2009/05/06/8-ways-to-share-your-git-repository/#gitosis
Pushing your local repo to to the gitosis server
将本地仓库推送到 gitosis 服务器
> $ cd project-X
> $ git remote add origin gitosis@gitosis-server:project-X.git
> $ git push origin master:refs/heads/master
This will create a directory project-X under /var/lib/gitosis/repositories/
Accessing the repository Nothing special here. If your key was added to the gitosis-admin repository, then you can acces it with.
这将在 /var/lib/gitosis/repositories/ 下创建一个目录 project-X
访问存储库 这里没有什么特别的。如果您的密钥已添加到 gitosis-admin 存储库,则您可以访问它。
> $ git clone gitosis@gitosis-server:project-X.git