GIT远程回购设置

时间:2014-11-05 18:17:32

标签: git

我想让我的GIT Remote工作。在我的Windows本地计算机上,GIT远程设置如下:

C:\xampp\htdocs\helloworld\test [master]> git remote
develop
C:\xampp\htdocs\helloworld\test [master]> git remote -v
 develop ssh://root@develop.livm.net:/var/www/html/demo/iMedicWare/nsg/helloworld/test/.git/ (fetch)
 develop ssh://root@develop.livm.net:/var/www/html/demo/iMedicWare/nsg/helloworld/test/.git/ (push)

我在Linux服务器上安装了GIT,应用程序将在该服务器上运行。我需要在Windows本地计算机和/或Linux服务器上设置什么才能从本地计算机上获取代码,以便将其推送到linux服务器上?

这是我在Windows本地计算机上运行的命令,用于推送linux服务器上的更改:

C:\xampp\htdocs\helloworld\test [master]> git push develop master
Warning: Permanently added 'develop.livm.net,192.168.19.70' (RSA) to the list of known hosts.
root@develop.livm.net's password:
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 358 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
To ssh://root@develop.livm.net:/var/www/html/demo/iMedicWare/nsg/helloworld/test/.git/
1527464..04f0441  master -> master
C:\xampp\htdocs\helloworld\test [master]>

从Windows本地计算机运行此命令后,我看不到linux服务器主分支上的代码更改。所以我不确定我做错了什么?

在我的远程机器上,项目在这里:

/var/www/html/demo/iMedicWare/nsg/helloworld/test/

并且里面有一个.git文件夹:

/var/www/html/demo/iMedicWare/nsg/helloworld/test/.git

该项目是否应该在.git文件夹内或我目前设置的方式?

2 个答案:

答案 0 :(得分:0)

从Linux服务器克隆项目时,请使用以下路径:

git clone ssh://root@develop.livm.net:/var/www/html/demo/iMedicWare/nsg/helloworld/test/

将其添加为当前项目的远程:尝试

git remote add new_develop ssh://root@develop.livm.net:/var/www/html/demo/iMedicWare/nsg/helloworld/test/

答案 1 :(得分:0)

事实证明我需要在我的git目录中添加一个钩子。现在我的本地和远程GIT工作得很好!我使用了更新后的钩子:

[root@develop hooks]# more post-update
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
# exec git update-server-info

GIT_WORK_TREE=/var/www/html/demo/iMedicWare/nsg/websiteactualwebdir git checkout -f

我发现并遵循这两个教程来指导我:http://toroid.org/ams/git-website-howto http://danielmiessler.com/study/git/

我需要更多地了解裸机与常规存储库和挂钩,这是我最初错过的。

相关问题