简体   繁体   English

git从存储库拉到服务器

[英]git pull from repository to server

I'm currently using a file on my mac to pull from a (bitbucket) repository to the server. 我当前在Mac上使用文件将(Bitbucket)存储库中的文件拖到服务器。 The file looks like this (it's a makefile ): 该文件如下所示(它是一个makefile ):

PUB_DIR="the/path/to/my/relevant/files"

server-pull:
    @ssh -t myusername@server "cd ${PUB_DIR}; git pull"

I can simply perform that action by calling make server-pull in the terminal. 我可以通过在终端中调用make server-pull来简单地执行该操作。 What I'd like to know is how to adapt this for windows, so I can call the function the same way through the command line tool like on my mac? 我想知道如何使它适应Windows,因此可以像在Mac上一样通过命令行工具以相同的方式调用该函数?

Probably the easiest way is to use the very same script: msysgit comes with Cygwin/MSYS, so you can execute shell scripts there too. 可能最简单的方法是使用相同的脚本:Cygwin / MSYS附带了msysgit,因此您也可以在那里执行shell脚本。 Just fire up a Git shell. 只需启动一个Git外壳即可。

The other way is to simply create a batch file (or a PowerShell script, just be prepared to add ssh to the path etc.), but I think using the same script in every environment has a huge advantage. 另一种方法是简单地创建一个批处理文件(或PowerShell脚本,只需准备将ssh添加到路径等),但是我认为在每种环境中使用相同的脚本具有巨大的优势。

If you want to stick with make, here's a thread about how to set it up for the Git shell. 如果您想坚持使用make,请参见以下有关如何为Git shell进行设置的主题

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

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