Статья последний раз была обновлена 04.03.2023
I would like to know if there is an easy way to push a GIT repository into production (on a FTP server) ?
asked Jun 1 ’10 at 13:25
Some tools recently added to the Git wiki:
git-ftp by René Moser is a simple
shell script for doing FTP the Git
way. Use git-ftp.sh to upload only the
Git tracked files to a FTP server,
which have changed since the last
upload. This saves time and bandwith.
Even if you play with different
branches, git-ftp.sh knows which files
are different. No ordinary FTP client
can do that.
git-ftp by Edward Z. Yang is a
simple script written in python for
uploading files in a Git repository
via FTP, only transferring new files
and removing old files.
answered Jun 1 ’10 at 15:22
thats perfect, thanks
Jun 1 ’10 at 17:16
Have you guys tried both? Which one do you guys like better?
Mar 5 ’12 at 8:35
using git-ftp, is there a way to push just a subdirectory (e.g. the publish folder of html5 boilerplate) to the specified ftp directory?
Aug 9 ’12 at 18:38
And what if there are several developers in the team. Is it still possible to use this scripts?
Aug 31 ’13 at 7:09
@Trilliput : A little late here, but yes, an intermediate server/vm on the network as the place where everyone pushes, and then : github.com/ezyang/git-ftp#using-a-bare-repository-as-a-proxy
– Pranav 웃
Nov 3 ’13 at 6:43
If you prefer GUI, use SourceTree, you can easily setup a Custom Action that uses git-ftp mentioned above. A brief description on setup (for Mac) at Push a Git repository to an FTP
answered Jun 19 ’13 at 11:32
really cool image, did you make it?
Sep 21 ’16 at 5:26
@Julix For the article mentioned.
Jan 12 ’17 at 13:09
If you’re on a mac and have Transmit, I’d recommend the following git-tranmit script (https://gist.github.com/379750). It uses DockSend to send only the last updated files. If you’re not familiar with DockSend, check out http://www.panic.com/blog/2010/11/15-secrets-of-transmit/.
- cp git-transit /usr/sbin/.
- cd /usr/sbin
- chmod +x git-transmit
- Setup drop send for your live app
- Run git-transmit in your git repository.
answered Aug 18 ’11 at 6:47
This script is rather clumsy about selecting ‘last updated files’. Check out this fork for a more elegant solution.
Feb 4 ’14 at 19:16
In addition to that you may want to transmit only tracked and uncommited files. Here’s a tiny script which does just that: gist.github.com/borisdiakur/37b8f512f6f8865b79c7
Feb 11 ’16 at 22:11
I’ve found PHPloy a great tool for sending your Git commits to remote servers over FTP. It works from the command-line and is written in PHP (and even detects changes in submodules).
git commit ... phploy -s staging phploy -s production
(Disclaimer: after using it for a while I’ve now contributed some code patches and improvements, making it Windows-compatible.)
answered Apr 11 ’14 at 12:43
Nice find, looks simple and powerful enough, I’ll definitely try it out.
Apr 13 ’16 at 17:26
git pull from the server to keep it up-to-date. Note, I would config your webserver to hide the git directory and such. And that’s just the beginning of the security concerns.
If you have any sort of compiling or processing, you should start looking at Ant, Maven, BuildR, SBT, etc.
answered Jun 1 ’10 at 13:36
The only problem with this is when you don’t have access to the production server, i.e. it might be simple shared hosting, with only FTP access.
Jun 13 ’12 at 5:25
This is a script in PHP to upload almost automatically the git-diff to a FTP server:
answered Oct 31 ’12 at 10:34
You can try FTPloy …
«Push changes to GitHub or Bitbucket.»
«Deploy Changes automatically to your server»
You have one free project to try it out with. I am currently using for a small php website and it works quite well. A few bugs on the site but its an active project so at least they are working on it.
answered Aug 22 ’16 at 17:53
I posted this answer prematurely. FTPloy is not quite ‘production ready’ and there are a lot of bugs. I couldn’t get it to work. I am using DeployHQ which works very well.
– Dave Thompson
Aug 26 ’16 at 10:14
Free for one project and it works very very well.
answered Aug 26 ’16 at 10:15
There’s a Ruby script here — Ruby git-deploy via FTP or SSH which uploads only the changed files in the git repo via FTP or SSH.
As mentioned in another answer, here is the Python git-ftp.py script which does a similar thing.
And here is the shell script version of git-ftp.
There is also a Ruby gem project called git-deploy which lets you setup a custom deploy via a git remote using the
git push command, in the same way as the Heroku and Azure services. For this one you may need to write custom methods to deploy via FTP and I think it assumes you have SSH access to your production server.
answered Jun 13 ’12 at 5:22
If you are putting code into production, I recommend using an «installer» such as an RPM package to install your code. That way it will be version stamped and you will be able to leverage the installer package to support updates to the production code. Git is not really designed to support production installations, it is intended to track changes to the code itself.
In any event, with an .RPM (or EXE or whatever) built, you can just FTP it to the production system and install it like any other package.
answered Jun 1 ’10 at 13:28
Well, git can be leverage pretty well for this purpose in reality. Check out the tag and create post-checkout, post-merge etc hooks to handle any installation procedures needed. We used to use RPM packages but after moving to git it was simply overkill.
Jun 1 ’10 at 13:32
Add it as a remote, then you can push to it, however simply pushing code isn’t enough, it needs to be merged with the working tree. The easiest way is to go the other way round, have a working tree on the server and fetch and merge into that.
answered Jun 1 ’10 at 13:35
You can always try to mount the ftp to a local directory using http://linuxconfig.org/mount-remote-ftp-directory-host-locally-into-linux-filesystem.
Then you can use it the same way as this.
answered Jan 9 ’16 at 17:18
I was struggling a lot to figure out this. I have figured out an easy way to get this done from various sources (git-ftpINSTALL, git-ftpUPLOAD, git-ftpIssue, git-ftpPUSH). You can read for reference but there is no need because I have mentioned step by step process below.
First thing first: Install git and curl using brew on MAC OS
brew install git brew install curl --with-ssl --with-libssh2 brew install git-ftp
Run the following commands:
git clone https://github.com/git-ftp/git-ftp.git cd git-ftp git tag # see available tags git checkout <tag> # checkout the latest tag by replacing <tag> sudo make install
Updating using git
git pull git tag # see available tags git checkout <tag> # checkout the latest tag by replacing <tag> sudo make install
git config git-ftp.url YourFtpServerName.Net git config git-ftp.user FtpUserName git config git-ftp.password YourPassword
Upload all files
git ftp init
Or if the files are already there
git ftp catchup
Work and deploy
echo "Hello StackOverflow" >> index.txt git commit application/libraries/index.txt -m "I love StackOverflow" git ftp push
If there is an error: pathspec ‘index.txt’ did not match any file(s) known to git. It means the file hasn’t been staged yet, so add the file and then try commit.
git add application/libraries/index.txt git commit application/libraries/index.txt -m "I love StackOverflow"
Hope this helps.
answered Apr 14 ’16 at 10:50
Sign up or log in
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Not the answer you’re looking for? Browse other questions tagged git ftp push or ask your own question.
- Как узнать IP-адрес по MAC-адресу - 07.04.2023
- Пинг проходит, а страницы в браузере не открываются - 07.04.2023
- Что если сайт пингуется «извне», но не открывается из под «локалки»? - 07.04.2023