IT박스

Git 푸시 인 프로덕션 (FTP)

itboxs 2020. 7. 2. 08:04
반응형

Git 푸시 인 프로덕션 (FTP)


FTP 서버에서 GIT 저장소를 프로덕션으로 푸시하는 쉬운 방법이 있는지 알고 싶습니다. 감사


최근 Git 위키 에 추가 된 도구들 :

René Moser의 git-ftp 는 FTP를 Git 방식으로 수행하기위한 간단한 쉘 스크립트입니다. git-ftp.sh를 사용하여 Git 추적 파일 만 FTP 서버에 업로드하십시오. FTP 서버는 마지막 업로드 이후에 변경되었습니다. 이렇게하면 시간과 대역폭이 절약됩니다. 다른 브랜치를 사용하더라도 git-ftp.sh는 어떤 파일이 다른지 알고 있습니다. 일반적인 FTP 클라이언트는 그렇게 할 수 없습니다.

Edward Z. Yang의 git-ftp 는 FTP로 Git 저장소에 파일을 업로드하고 새 파일을 전송하고 오래된 파일 만 제거하기 위해 Python으로 작성된 간단한 스크립트입니다.


GUI를 선호하는 경우 SourceTree를 사용하면 위에서 언급 한 git-ftp를 사용하는 사용자 지정 동작을 쉽게 설정할 수 있습니다. Git 리포지토리를 FTP푸시 에서 설정 (Mac 용)에 대한 간단한 설명

여기에 이미지 설명을 입력하십시오


PHPloy 가 Git 커밋을 FTP를 통해 원격 서버로 보내는 훌륭한 도구라는 것을 알았 습니다. 명령 줄에서 작동하며 PHP로 작성되었으며 하위 모듈의 변경 사항도 감지합니다.

https://github.com/banago/PHPloy

git commit ...
phploy -s staging
phploy -s production

끝난!

(면책 조항 : 잠시 동안 사용한 후 이제 일부 코드 패치 및 개선 사항에 기여하여 Windows 호환 가능합니다.)


Mac을 사용하고 있고 전송 중이라면 다음 git-tranmit 스크립트 ( https://gist.github.com/379750 )를 권장합니다 . DockSend를 사용하여 마지막으로 업데이트 된 파일 만 보냅니다. DockSend에 익숙하지 않은 경우 http://www.panic.com/blog/2010/11/15-secrets-of-transmit/를 확인 하십시오 .

설정:

  1. cp git-transit / usr / sbin /.
  2. cd / usr / sbin
  3. chmod + x 자식 전송
  4. 라이브 앱에 대한 설정 드롭 전송
  5. git 저장소에서 git-transmit을 실행하십시오.

That's not what git is for, strictly speaking. However, if your source is something that doesn't need compiling or processing, say a website consisting entirely of html and javascript files and the like, you could have a clone of the repo on your webserver and use 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.


This is a script in PHP to upload almost automatically the git-diff to a FTP server:

http://code.google.com/p/upload-git-diff-with-ftp/


You can try FTPloy ...

https://ftploy.com

"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.


https://www.deployhq.com/

Free for one project and it works very very well.


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.


You could use Deployhq.com it works like a charm, the only thing you need to do is to set up your repository and FTP account.

They currently the following version control systems:

Git, Subversion, Mercurial.

With repository hosted

  • GitHub
  • Bitbucket
  • GitLab
  • Codebase

여기에 이미지 설명을 입력하십시오


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.


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.


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.


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

Setup

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

오류 가있는 경우 : pathspec 'index.txt'가 git으로 알려진 파일과 일치하지 않습니다 . 파일이 아직 준비되지 않았으므로 파일을 추가하고 커밋을 시도하십시오.

git add application/libraries/index.txt
git commit application/libraries/index.txt -m "I love StackOverflow"

도움이 되었기를 바랍니다.

참고 URL : https://stackoverflow.com/questions/2950107/git-push-into-production-ftp

반응형