简体   繁体   English

将git存储库推送到服务器

[英]push git repository to server

I've committed many things into my local repository and even pushed things to shared repositories saved online with team members. 我已经将许多事情提交到本地存储库中,甚至将其推送到与团队成员在线保存的共享存储库中。 I now am looking for a way to store the files that I have on my html directory on my server into my online git, which I can then share with my local repository, and when I make changes locally to automatically commit and push to the remote site in turn updating my server files. 我现在正在寻找一种方法,可以将服务器上html目录中的文件存储到在线git中,然后可以与本地存储库共享该文件,并可以在本地进行更改以自动提交并推送到远程网站反过来更新我的服务器文件。 Currently I'm using Coda to ssh the files over automatically to the server every time I hit save. 目前,每次点击保存时,我都使用Coda自动将文件切换到服务器。

I recently ran into a problem where I accidentally deleted some files on my server during coding, which made me think that had I have git installed I could have just reverted back to a previous date! 最近我遇到一个问题,在编码过程中我不小心删除了服务器上的一些文件,这让我觉得如果我已经安装了git,就可以恢复到以前的日期! so without further ado I really would like to implement something like this. 因此,事不宜迟,我真的很想实现这样的事情。

I have done some research on how I could push to my remote repository on the server and found this this tutorial, tutorial link 我对如何推送到服务器上的远程存储库进行了一些研究,并找到了本教程,本教程的链接

But I have an amazon EC2 instance and I am not sure how to run the command line on server which is what I assume I have to do in step one of the tutorial where I need to create a git on the server directory 但是我有一个Amazon EC2实例,我不确定如何在服务器上运行命令行,这是我假设必须在教程的第一步中执行的操作,我需要在服务器目录上创建git

could anyone give me some guidance on how to do this effectively so that all works well in the end? 谁能给我一些有关如何有效执行此操作的指导,以便最终一切正常?

There are plenty of tutorials around. 周围有很多教程。 One pretty interesting (because of it's ease) is been explained here . 这里解释一个非常有趣的(因为很容易)。 It basically uses a git hook to update the code on your EC2 instance by pushing to a specific remote repository. 它基本上使用git hook通过推送到特定的远程存储库来更新EC2实例上的代码。

All you need it ssh access to the server and git installed there. 您只需要ssh即可访问服务器和安装在其中的git。

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

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