我在openshift上有我的项目。我提交并推送了我的git远程主机上的一些更改,但在ssh登录服务器后意外删除了它们。我试图重新添加它们提交它们并推送它们但是当我提交它时说没有什么可以提交的。我试图强迫推,但它说一切都是最新的。有没有办法在没有回复的情况下重新发布一些东西?
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
如何重新推送目录?
答案 0 :(得分:0)
我不熟悉 openshift ,但我认为有一个git post-receive 在服务器上挂钩,检查你的主分支到某个工作 。目录
您应该检查远程服务器上此挂钩的内容(它应该是
位于~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用户身份登录时运行该命令;跑来跑去 另一个用户将导致文件权限问题。