Git推送到裸露的存储库而不反映变化

时间:2017-09-22 23:19:18

标签: git bash atlassian-sourcetree

在我的本地计算机上,我在bitbucket中有dev分支和prod存储库的master分支。此主存储库在我的本地远程数据库上为origin。我还有一个托管为bare repository的网络服务器来推送更改。这个裸存储库在我的本地遥控器上是prod-server

当我将prod的内容推送到prod-server master时,生产服务器会告诉我Everything up-to-date;但是,如果我检查网络服务器的文件,他们更改的时间戳和内容不会反映我的提交中的更改!

GIT中-的bash

kareem.elashmawy@domain.com MINGW32 /c/git/ObfuscatedProjectName (prod)
$ git push prod-server prod:master -f
Password:
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 445 bytes | 445.00 KiB/s, done.
Total 4 (delta 3), reused 0 (delta 0)
remote: fatal: This operation must be run in a work tree
To ssh://prodserver.com/ObfuscatedProjectName
   d24b1492..1898d38c  prod -> master

kareem.elashmawy@domain.com MINGW32 /c/git/ObfuscatedProjectName (prod)
$ git push prod-server prod:master -f
Password:
Password:
Everything up-to-date

git登录服务器

commit 1898d38c67a1c35c30e002a4bc53b161973a944e
Author: Kareem Elashmawy <kareem.elashmawy@domain.com>
Date:   Fri Sep 22 18:59:07 2017 -0400

    second commit today

commit d24b14928f3c0b950a2d1a09958bce3e6659386e
Author: Kareem Elashmawy <kareem.elashmawy@domain.com>
Date:   Fri Sep 22 18:34:53 2017 -0400

    first commit today

commit e0de2b25d1cffb583f4a4b1fccbd88416ddac79f
Author: Kareem Elashmawy <kareem.elashmawy@domain.com>
Date:   Thu Sep 21 18:02:51 2017 -0400

    yesterday's commit

服务器上的ls -l <​​/ p>

[kareem@domain python]$ ls -l
total 748
-rwxrwxr-x. 1 apache company    2126 Jul 21 15:36 file.py
-rwxrwxr-x. 1 kareem kareem  1733 Sep 21 17:18 file2.py
-rwxrwxr-x. 1 apache company    1461 Sep 21 17:44 file3.py
-rwxrwxr-x. 1 apache company   27257 Jul 21 15:36 file4.py
-rw-r--r--. 1 root   root   22597 Jul 25 11:50 file5.pyc
-rwxrwxr-x. 1 apache company    1458 Sep 21 18:08 file6.py

请注意文件3,4和5的时间戳?它们对应于昨天的提交,但在今天的2次提交中已更改。如果我直接打开文件并检查它们的内容,尽管git日志另有说明,但它们自昨天以来确实没有变化。

/ ObfuscatedProjectName /钩/后接收

#!/bin/sh 
GIT_WORK_TREE=/home/ObfuscatedProjectName git checkout -f

1 个答案:

答案 0 :(得分:0)

已经设置了一个post-receive hook,以便在收到提交后签出存储库。目录网址错误。

#!/bin/sh 
GIT_WORK_TREE=/home/ObfuscatedProjectName git checkout -f

/home/ObfuscatedProjectName应该是/ObfuscatedProjectName