以文档根目录的远程Git存储库 [英] Remote Git Repository in document root
本文介绍了以文档根目录的远程Git存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
mkdir / home / website / public_html
cd / home / website / public_html
git --bare init
然后我转到本地机器并切换到目录我有我的文件
git remote rm origin
git remote add origin git@server.com:/ home / website / public_html
git push origin master
输入密钥'/c/Users/git/.ssh/id_rsa'的密码:
计数对象:6,完成。
使用多达8个线程的增量压缩。
压缩对象:100%(3/3),完成。
写入对象:100%(6/6),460字节,完成。
总计6(delta 0),重用0(delta 0)
到git@server.com:/ home / website / public_html
* [new branch] master - > master
但现在当我回到我的服务器时:
ls / home / website / public_html
分支配置说明HEAD钩子信息对象refs
我将哪些文件推送到服务器?我是否以这种错误的方式去做? (我推送的本地文件夹中只有一个自述文件)
解决方案
您已在服务器上创建了一个裸存储库。裸仓库没有工作区域。
我假设您正尝试使用Git进行网站发布?有关一个选项,请参见此链接。简而言之:
- 您在服务器上创建2个存储库。其中一个是裸仓库,就像您已创建的仓库一样,但它不在public_html目录中。
- 其他是public_html目录中的普通存储库
- 您创建一个post-receive挂钩,只要您推送到裸存储库,就会更新public_html目录中的存储库
Im trying to use git for my website. The website is on our webserver.
mkdir /home/website/public_html
cd /home/website/public_html
git --bare init
Then I go to the local machine and change into the directory where I have my files
git remote rm origin
git remote add origin git@server.com:/home/website/public_html
git push origin master
Enter passphrase for key '/c/Users/git/.ssh/id_rsa':
Counting objects: 6, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (6/6), 460 bytes, done.
Total 6 (delta 0), reused 0 (delta 0)
To git@server.com:/home/website/public_html
* [new branch] master -> master
But now when I got to my back to my server:
ls /home/website/public_html
branches config description HEAD hooks info objects refs
Where are my files I pushed to the server? Am I going about this the wrong way? (the only thing in the local folder I pushed from was a readme)
解决方案
You have created a bare repository on the server. Bare repositories do not have a working area.
I assume you are trying to use Git for website publishing? See this link for one option. In short:
- You create 2 repositories on the server. One is a bare repository, just like the one you have already created, but it's outside of the public_html directory
- Other is a normal repository inside the public_html directory
- You create a post-receive hook that updates the repository inside the public_html directory whenever you push to the bare repository
这篇关于以文档根目录的远程Git存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文