在下面的教程中无法使用git推送live

在下面的教程中无法使用git推送live,git,error-handling,ssh,zend-framework2,push,Git,Error Handling,Ssh,Zend Framework2,Push,我遵循了这个教程 我什么都做了,跟着它去喝茶 我在本地机器上,我对一个文件进行了更改,并且 git commit -a -m "test" 然后: 然后它会询问我的服务器密码 所以我输入并得到这个错误: stdin: is not a tty Counting objects: 13, done. Delta compression using up to 2 threads. Compressing objects: 100% (5/5), done. Writing objects: 1

我遵循了这个教程

我什么都做了,跟着它去喝茶

我在本地机器上,我对一个文件进行了更改,并且

git commit -a -m "test"
然后:

然后它会询问我的服务器密码 所以我输入并得到这个错误:

stdin: is not a tty
Counting objects: 13, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (7/7), 504 bytes, done.
Total 7 (delta 4), reused 0 (delta 0)
remote: 
remote: **** Pulling changes into live
remote: 
remote: From /var/git/agriTech
remote:  * branch            master     -> FETCH_HEAD
remote: error: Your local changes to 'module/Application/view/layout/layout.phtml' would be overwritten by merge.  Aborting.
remote: Please, commit your changes or stash them before you can merge.
remote: Updating 5a53563..7236cb6
To root@217.199.160.153:/var/git/agriTech.git
   5b4fafd..7236cb6  master -> master

我已经快速阅读了教程

在服务器上,您可以在存储库
/var/www/myproject
(根据教程约定命名)中进行本地修改。 此存储库不应直接更新,否则它可能包含未版本的修改,这不是您想要的

错误原因:当您执行
git推送时,
/var/git/myproject.git
尝试更新
/var/www/myproject
,但由于它有本地修改,更新失败

解决方案:

  • 进入服务器上的
    /var/www/myproject
    并运行
    git reset--hard HEAD
    。这将删除所有本地修改
  • 现在,您可以从本地机器上重试一次git推送,一切都会好起来的
为了避免将来出现问题,您可以在
/var/git/myproject.git/hooks/post update
文件中的
unset git\u DIR
行之后添加
git reset--hard HEAD

stdin: is not a tty
Counting objects: 13, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (7/7), 504 bytes, done.
Total 7 (delta 4), reused 0 (delta 0)
remote: 
remote: **** Pulling changes into live
remote: 
remote: From /var/git/agriTech
remote:  * branch            master     -> FETCH_HEAD
remote: error: Your local changes to 'module/Application/view/layout/layout.phtml' would be overwritten by merge.  Aborting.
remote: Please, commit your changes or stash them before you can merge.
remote: Updating 5a53563..7236cb6
To root@217.199.160.153:/var/git/agriTech.git
   5b4fafd..7236cb6  master -> master