2014-12-23 14 views
-1

我有我的項目openshift。我在git遠程主機上提交併推送了一些更改,但在ssh登錄到服務器後意外刪除了它們。我試圖重新添加它們提交它們並推送它們,但是當我提交它時說沒有提交。我試圖強制推動,但它說,一切都是最新的。有沒有辦法重新提交一些東西而沒有恢復?重新推一個目錄到遠程git後意外刪除它

git add path/to/my/directory/ 
git commit -m "Re commiting" 
On branch master 
Your branch is up-to-date with 'origin/master'. 

nothing to commit, working directory clean 

試過這

git push -f 
warning: push.default is unset; its implicit value is changing in 
Git 2.0 from 'matching' to 'simple'. To squelch this message 
and maintain the current behavior after the default changes, use: 

    git config --global push.default matching 

To squelch this message and adopt the new behavior now, use: 

    git config --global push.default simple 

When push.default is set to 'matching', git will push local branches 
to the remote branches that already exist with the same name. 

In Git 2.0, Git will default to the more conservative 'simple' 
behavior, which only pushes the current branch to the corresponding 
remote branch that 'git pull' uses to update the current branch. 

See 'git help config' and search for 'push.default' for further information. 
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 
'current' instead of 'simple' if you sometimes use older versions of Git) 

Everything up-to-date 

我怎樣才能重新把我的目錄?其中籤出master分支一定工作 目錄服務器上

回答

0

我不熟悉openshift,但我相信,有一個混帳後收到 掛鉤。

您應該檢查遠程服務器上的鉤子的內容(它應該是 ,位於~git/repositories/project.git/hooks/post-receive之類的東西)。 更感謝有可能的,它會包含類似於下面的命令:

GIT_DIR=~git/repositories/project.git/ GIT_WORK_TREE=/var/www/vhosts/project git checkout -f master 

您應該然後運行該命令同時登錄的用戶的git;作爲 運行,另一個用戶將導致文件權限問題。

相關問題