简体   繁体   English

Git Push远程修改的文件

[英]Git Push Remote Modified files

I'm using git server on a development environment to essentially be the "ftp" / handler via SSH. 我在开发环境上使用git服务器,实际上是通过SSH的“ ftp” /处理程序。

I init'd git on the remote server via bare and pushed from local. 我通过裸机在远程服务器上初始化git并从本地推送。 Once all settled I removed bare. 一旦所有解决,我裸露。 I then push remote latest batch = accepted. 然后,我推送远程最新批次=已接受。

On the remote server I run git status and see modified files. 在远程服务器上,我运行git status并查看修改后的文件。 How can it accept the changes with out having to reset or so? 它如何能够接受更改而不必重设密码?

A better approach: 更好的方法:

  1. Keep a bare repository on the server, that you will push to 在服务器上保留一个裸存储库,您将推送到
  2. Create a clone on the server of the bare repository 在裸仓库的服务器上创建一个克隆
  3. Setup a post-receive hook on the bare repository, that will do a git pull on the clone after it receives new commits 在裸存储库上设置接收后钩子,在接收到新的提交后,它将对克隆执行git pull

With this setup, you can push revisions to the bare repository, and its clone will update itself. 使用此设置,您可以将修订推送到裸存储库,并且其克隆副本也会更新。 I wrote a blog post on this with more details. 我写了一篇博客文章 ,其中有更多详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM