简体   繁体   中英

Deploying to FTP directly with a `git push`?

I'm wondering if I can configure a remote FTP branch in git so that I can just push to github and then push to deployment right after one another.

If I could, this would be awesome.

Otherwise, what other options are there for quick and easy deployment? Can git use ssh or anything like that? My host is SDF.org, and you can see the options they offer to validated users here: http://sdf.org?join

I am using another approach for deployment of my files over ssh/ftp: instead of using a git push, I pack the wanted files as a .tar.gz archive and upload that using scp or the corresponding ftp commands. See the section "The Hook" in my blog entry. There, I find all wanted files using find and pack them using tar:

find . -name "*.html" -o -name "*.css" -o -name "*.js" | tar -czf archive.tgz --files-from -

After doing that, you can simply upload the file using scp and unpack with a command over ssh :

scp archive.tgz mamuelle@g<domain>:~/.public_html/
ssh mamuelle@<domain> tar xfz .public_html/archive.tgz -C .public_html

You can do the same thing using ftp. Check out the corresponding manual on how to upload files to ftp.

What I described above can be started automatically using hooks. I use it with post-merge , for example.

Another option is described in this answer . There are simple shell scripts to upload a file via git-push .

edit With ssh, you can also directly push to a bare remote repository.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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