使用 Synology 的官方套件在 NAS 上设置 GIT
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20074692/
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
Set up GIT on a NAS with Synology's official package
提问by FR073N
I bought 2-3 months ago a Synology 213air NAS for programing purpose.
我在 2-3 个月前购买了 Synology 213air NAS 用于编程目的。
Then before trying to set up git manually on my NAS, I heard that DSM4.3 will propose Synology's official package. So I decided to wait.
然后之前尝试在我的NAS上手动设置git,听说DSM4.3会提出Synology的官方包。所以我决定等待。
The DSM4.3 with Git package is now out : http://www.synology.fr/dsm/dsm_app.php#Git, but there is no tutorial for beginners like me to set up Git.
带有 Git 包的 DSM4.3 现已发布:http: //www.synology.fr/dsm/dsm_app.php#Git,但没有像我这样的初学者设置 Git 的教程。
So :
所以 :
- How do we do to set up this official package ?
- How can I create a repo with one of my projects on my NAS ?
- Finally, how will I do to "interact" with my project ?
- 我们如何设置这个官方包?
- 如何使用我的 NAS 上的一个项目创建存储库?
- 最后,我将如何与我的项目“交互”?
回答by zako42
I found some helpful info on the Synology forum here:
我在 Synology 论坛上找到了一些有用的信息:
http://forum.synology.com/enu/viewtopic.php?f=190&t=73064
http://forum.synology.com/enu/viewtopic.php?f=190&t=73064
First you should install the package via your Diskstation package manager and enable it. This will create a Git folder on the NAS. I created a user called "gituser" and granted it read/write permissions to the Git folder. You don't need to do that, but I like to create users specifically for different functions on the NAS. From there, you will need to set up your repository manually, because there is no graphical interface provided by Synology yet.
首先,您应该通过 Diskstation 软件包管理器安装该软件包并启用它。这将在 NAS 上创建一个 Git 文件夹。我创建了一个名为“gituser”的用户,并授予它对 Git 文件夹的读/写权限。您不需要这样做,但我喜欢专门为 NAS 上的不同功能创建用户。从那里,您需要手动设置您的存储库,因为 Synology 还没有提供图形界面。
To create a repository, you will need to enable SSH for your NAS. Go to the control panel --> terminal --> enable SSH service and make sure it's enabled. Now SSH to it using the admin account / password. cd to the volume you created for the NAS (probably volume1). There should be the git folder there. cd to it and create your repository there.
要创建存储库,您需要为 NAS 启用 SSH。转到控制面板 --> 终端 --> 启用 SSH 服务并确保它已启用。现在使用管理员帐户/密码通过 SSH 连接到它。cd 到您为 NAS 创建的卷(可能是 volume1)。那里应该有 git 文件夹。cd 到它并在那里创建您的存储库。
for example:
例如:
ssh admin@nas
cd volume1/git
git init --bare --shared reponame.git
(add files, etc)
Then using an account which has access to the git folder, you should be able to pull and push, etc.
然后使用可以访问 git 文件夹的帐户,您应该能够拉和推等。
回答by Chase
You never needed the Git Server package because you could locally create a bare repo and then upload that to your NAS. They you would just have to enable WebDAV to access it. The Git Server package allows you to ssh into the NAS as root and create the bare repo on the NAS instead of having to upload it. You also can enable users to use the SSH protocol instead of just HTTP/HTTPS once you install the Git Server package. I created a tutorial about it: http://blog.osdev.org/git/2014/02/13/using-git-on-a-synology-nas.html
您从不需要 Git Server 包,因为您可以在本地创建一个裸仓库,然后将其上传到您的 NAS。他们只需要启用 WebDAV 即可访问它。Git Server 包允许您以 root 身份 ssh 进入 NAS 并在 NAS 上创建裸存储库,而不必上传它。一旦您安装了 Git Server 包,您还可以让用户使用 SSH 协议,而不仅仅是 HTTP/HTTPS。我创建了一个关于它的教程:http: //blog.osdev.org/git/2014/02/13/using-git-on-a-synology-nas.html
回答by crimbo
I found this article to be really helpful: http://www.sbprojects.com/knowledge/internetwork/synologygit/index.php
我发现这篇文章真的很有帮助:http: //www.sbprojects.com/knowledge/internetwork/synologygit/index.php
In addition, here's the gitbook reference on setting up a git server: http://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-ServerYou'll want to skip the adduser command, because presumably you'll be using the user accounts that are already present on the synology.
此外,这里的一对架设Git服务器的gitbook参考: http://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server你要跳过 adduser 命令,因为大概您将使用 Synology 上已经存在的用户帐户。
回答by Andrea
This solution is quite simple and works great for me (tested with DSM 5.1):
这个解决方案非常简单,对我来说效果很好(用 DSM 5.1 测试过):
http://blog.netgloo.com/2015/04/20/git-server-on-synology-ds115j-installation-and-configurations/
http://blog.netgloo.com/2015/04/20/git-server-on-synology-ds115j-installation-and-configurations/
These are the main steps:
这些是主要步骤:
- Installing Git Server from the DSM's dashboard
- Creating a new shared repository on the server (via ssh)
- Use the repository on your local pc
- [Optional] Configuring for commit without password (with ssh keys)
- 从 DSM 的仪表板安装 Git 服务器
- 在服务器上创建一个新的共享存储库(通过 ssh)
- 使用本地电脑上的存储库
- [可选] 配置无密码提交(使用 ssh 密钥)