search

Home  >  Q&A  >  body text

git - 请教远程文件的同步问题

新手第一次碰到这样的问题,麻烦大家了,

我有一个网站host在amazon的ec2上,
OS用的是windows server 2008,网站的server用的是apache,
上传文件到ec2用的是windows 7 自带的 remote desktop connection,

问题是现在我经常性的要更新代码,每次要记住更新了哪些文件不可靠也不方便,
现在想到的办法是,在ec2的windows上装个git server,这样我在本地可以push
更新到remote server, 请教有经验的各位同学,具体要这么实现?
(有个土办法是通过github做中转站,但是不想这么做)
谢谢!

怪我咯怪我咯2800 days ago623

reply all(4)I'll reply

  • 迷茫

    迷茫2017-04-22 09:02:32

    Why use Windows…

    To build a secure git server, it is best to use the ssh protocol, so install Cygwin so that sshd + git can be used. So you create a bare warehouse on the server and push it directly.

    reply
    0
  • 迷茫

    迷茫2017-04-22 09:02:32

    Updated to git.oschina, gitcafe. It is more troublesome to build the git service by yourself, and there is no web interface.

    Then write a script to synchronize both ends, push locally and pull remotely

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-22 09:02:32

    Thank you Evian and kxh for your answers, now I have found a simpler way, haha

    On the local machine and server machine, download google drive as a transfer station,
    Use git to push everything to the local Google Drive directory, and it will automatically sync,
    Then on the server machine, copy the contents of the directory where Google Drive is located (it has been automatically updated),
    Just use git pull to where I need it.

    The disadvantage of this method is that it can only be used by myself.
    bitbucket has a free private repo, which is more convenient!

    reply
    0
  • PHP中文网

    PHP中文网2017-04-22 09:02:32

    Haven’t been here for a long time. Or write down your own approach.

    Use Github as the code repository, install Git on the server, and configure the key.
    The server writes a deployment interface (pull the latest code from Github), and then configures webhook on Github,
    done.
    In this way, every time you push to Github, the server will automatically pull in new code and deploy it (for security and stability, write a deployment log for easy viewing).

    reply
    0
  • Cancelreply