我目前在我的 win7 计算机上的虚拟机中安装了 Fedora 17。我想配置虚拟机来使用 git 管理我的项目。我在 win7 上使用 eclipse helios 和 egit 插件,我的项目当前驻留在本地。 Git 和所有依赖项已安装在 VM 上。 VM 的主机名是 dev.local 并且已经安装了 SSH,因此我将使用以下 URL 进行访问: ssh://[email protected] :/php/projects/myframework.git
我的问题是,如何在虚拟机上初始化新的 git 存储库,然后将本地项目推送到虚拟机中,以便由虚拟机中的 git 管理?
最佳答案
好吧,我终于明白了。我最终做的是在我的 VM(即我的 Git 服务器)上创建我的 git 目录:
# mkdir /home/brett/myproject.git && cd /home/brett/myproject.git
# git init --bare
在我的客户端上,在项目文件夹中 (C:\www\myproject):
# git init
# git add .
# git commit -m "Initial commit"
# git remote add origin ssh://<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="731101160707331716055d1f1c10121f" rel="noreferrer noopener nofollow">[email protected]</a>/myproject.git
# git push origin master
我删除了项目的客户端副本,并在 Eclipse 中,文件 > 导入 > Git > 来自 Git 的项目,选择 URI。
我插入了详细信息以访问 dev.local 上的 git 存储库,并能够在 eclipse 中创建本地副本。
无论如何,感谢所有花时间回复此问题的人。我实际上在网上找到了一篇不错的文章,很有帮助。
关于eclipse - 如何配置 git 服务器来共享项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11229837/