Git Push工作,但文件不在服务器上

时间:2013-06-26 02:11:22

标签: git ssh push git-push

我在HostGator共享帐户上设置了一个git,我刚刚完成了第一次推送。但是,当我在服务器上查看文件不存在时 - Push没有出错或说出任何错误。

我正在使用SSH类型连接,如果这有任何区别。我跟着this guide建立了一个git repo。据我所知,远程原始网址是正确的。

本地LS:

/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.

2 个答案:

答案 0 :(得分:5)

文件在那里,你只是看不到它们,因为它们嵌入到Git数据库中。这是使用--bare或不使用.git初始化存储库之间的区别(请参阅git-init man pagethis page)。在服务器端,您只能看到您应该看到项目的常用{{1}}文件夹的内容。尝试再次克隆另一个目录中的相同存储库,如果您可以检索修改,那么您的设置工作正常。

答案 1 :(得分:0)

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

git reset --hard

git stash