在 CentOS 服务器上设置 GIT

Ved*_*ran 1 java fedora centos git

我正在尝试在我的家庭 CentOS 6.2 服务器上设置 GIT(我已经在它上面运行了 LAMP)。对它的唯一访问是从本地网络——或者更准确地说,是从我运行 Fedora 16 的笔记本电脑。不幸的是,我找不到一个好的“操作方法”来做到这一点。

我在服务器上安装了它,但下一步是什么?我需要对其进行哪些修改?我如何连接到它并将它与例如我用于 PHP 的 NetBeansIDE 一起使用。

欢迎任何提示或“操作方法”。

cjc*_*cjc 5

在服务器上:

$ cd /path/to/directory/
$ git init
$ git add .
$ git commit -m 'Initial commit'
Run Code Online (Sandbox Code Playgroud)

这将设置基本存储库并将所有文件添加/path/to/directory到其中。

在笔记本电脑上:

$ git clone username@server:/path/to/directory/
Run Code Online (Sandbox Code Playgroud)

git 将通过 ssh 连接以检索和克隆 repo。

此时,您可以进行更改、提交并执行git push,它将通过 ssh 将新提交推送到存储库。

由于您已经描述了一个只有您自己而不是其他人的简单设置,因此通过 ssh 工作应该没问题。您不需要设置 git 守护进程。

这里有更多信息:

http://fclose.com/b/linux/366/set-up-git-server-through-ssh-connection/

实际上,如果您环顾四周,应该有很多 git 教程。