Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git推送工作正常,但文件不在服务器上_Git_Ssh_Push_Git Push - Fatal编程技术网

Git推送工作正常,但文件不在服务器上

Git推送工作正常,但文件不在服务器上,git,ssh,push,git-push,Git,Ssh,Push,Git Push,我在我的HostGator共享帐户上设置了一个git,我刚刚进行了第一次推送。但是,当我查看服务器时,文件不在那里——Push没有抛出错误,或者说有任何错误 如果这有什么区别的话,我使用的是SSH类型的连接。我随后建立了git回购协议。据我所知,远程源URL是正确的 本地牌照: /Applications/MAMP/htdocs/cyclesafestl [master] $ ls /Applications/MAMP/htdocs/cyclesafestl total 32 -rw-r--r

我在我的HostGator共享帐户上设置了一个git,我刚刚进行了第一次推送。但是,当我查看服务器时,文件不在那里——Push没有抛出错误,或者说有任何错误

如果这有什么区别的话,我使用的是SSH类型的连接。我随后建立了git回购协议。据我所知,远程源URL是正确的

本地牌照:

/Applications/MAMP/htdocs/cyclesafestl [master] $ ls

/Applications/MAMP/htdocs/cyclesafestl
total 32
-rw-r--r--@ 1 503  80    81 Jun 19 10:49 BETA.txt
-rw-r--r--  1 503  80  1772 Jun 18 23:11 index.php
-rw-r--r--@ 1 503  80   616 Jun 18 22:49 info.txt
drwxr-xr-x  7 503  80   238 Jun 17 22:59 includes/
-rw-r--r--  1 503  80    76 Jun 17 16:18 README.md
服务器LS:

./
../
HEAD
branches/
config
description
hooks/
info/
objects/
refs/
Git推送信息:

/Applications/MAMP/htdocs/cyclesafestl [master] $ git push -u origin master
Counting objects: 45, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (45/45), done.
Writing objects: 100% (45/45), 498.12 KiB, done.
Total 45 (delta 1), reused 0 (delta 0)
To ssh://xxx@thehivestl.com:xxx/home2/xxx/public_html/thehivestl.com/cyclesafestl
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.

文件就在那里,你看不到它们,因为它们被嵌入到Git数据库中。这就是使用
--bare
初始化存储库与不使用存储库的区别(请参阅和)。在服务器端,您只能看到通常的
.git
文件夹的内容,您应该在其中查看项目。尝试在另一个目录中再次克隆同一存储库,如果您可以检索到您的修改,则您的安装工作正常。

完成推送后。在远程服务器上运行以下命令之一

git reset --hard


说得好!我尝试了克隆,文件就在那里,但是我希望在我的服务器上使用它作为一种登台平台,这样我就可以用我所有的mysql数据库进行推送和测试。但是当我转到相对URL时,我无法查看页面。我是否应该用git init重新创建页面并去掉--bare?我建议将内容分开。此存储库用于备份。如果您想设置一个临时平台,更好的解决方案是在另一个目录上克隆存储库,并使用git钩子(例如)使其保持最新。因此,我可以在临时目录中的服务器上克隆此repo,git钩子有何帮助?我是否可以设置一个钩子,在推送文件时发出通知,并使文件在暂存目录中保持最新状态?一个简单的解决方案是将post接收钩子(请参阅)设置为类似“cd$staging dir&&git pull origin master”的内容,我会将其添加到暂存repo的配置中,对吗另外,我可以就此提出另一个问题,但当我在服务器中尝试克隆时,我会遇到超时问题吗?tbremer@tbremer.com[~/public\u html/thehivestl.com/staging.cyclesafestl]#git clone-vssh://xxx@thehivestl.com:xxx/home2/xxx/public_html/thehivestl.com/cyclesafestl.git克隆到“cyclesafestl”。。。ssh:连接到主机hivestl.com端口xxx:连接超时致命:远程端意外挂起
git stash