GIT 支持推送到 ftp 服务器吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4664251/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 09:50:20  来源:igfitidea点击:

Does GIT support push to an ftp server?

gitftpgit-push

提问by yoyo

I believe git ftp support is a somewhat recent addition, but the git push docs doclearly state that "Git natively supports ssh, git, http, https, ftp, ftps, and rsync protocols." (emphasis added)

我相信 git ftp 支持是最近才添加的,但 git push 文档确实明确指出“Git 本身支持 ssh、git、http、https、ftp、ftps 和 rsync 协议。” (强调)

However, others have asked what to do if git fails to push to ftp server, and I am having exactly the same problem.

但是,其他人问如果git 无法推送到 ftp server该怎么办,我遇到了完全相同的问题。

So -- can anyone definitively state whether or not "git push" works with the ftp protocol?

那么 - 任何人都可以明确说明“git push”是否适用于 ftp 协议?

If yes ... then can anyone answer that other question? :-)

如果是……那么任何人都可以回答其他问题吗?:-)

If no ... is this in the works, or should I be looking at git-ftp?

如果没有......这是在工作中,还是我应该看看git-ftp?

I'm using git 1.7.3.1 under Windows.

我在 Windows 下使用 git 1.7.3.1。

Many thanks for any info or advice! (BTW, I had this question all nicely hyperlinked, but as a lowly 1-rank I only get one link, so had to remove the others ...)

非常感谢您的任何信息或建议!(顺便说一句,我有这个问题都很好地超链接,但作为一个低一级的我只有一个链接,所以不得不删除其他...)

采纳答案by maikel

No, Git does not support a push to an FTP server, only clone and fetch. This was previously answered.

不,Git 不支持推送到 FTP 服务器,只支持 clone 和 fetch。这是以前回答的

But there are several tools to upload your code to an FTP server that work with Git.

但是有几种工具可以将您的代码上传到使用 Git 的 FTP 服务器。

  • Git-ftp- A shell script that uploads your current commit. It stores the last uploaded commit id and uploads only changed files.
  • ezyang/git-ftp- A python script that uploads commits as well. It comes with a post-receive hook to deploy from a bare repository. But the last commit is more than three years old.
  • PHPloy- A php script that also uploads only changed files by storing the commit id.
  • Grunt-git-ftp- A Grunt script that uploads only changed files as well.
  • Git-ftp- 上传当前提交的 shell 脚本。它存储最后上传的提交 ID 并仅上传更改的文件。
  • ezyang/git-ftp- 一个也上传提交的 python 脚本。它带有一个 post-receive 钩子,可以从一个裸存储库中进行部署。但是最后一次提交已经超过三年了。
  • PHPloy- 一个 php 脚本,它也通过存储提交 id 只上传更改的文件。
  • Grunt-git-ftp- 一个 Grunt 脚本,它也只上传更改过的文件。

回答by Mark Ma

I think you should use ftp-git, it's a GUI tool to push changed files in git repository to ftp server.

我认为你应该使用ftp-git,它是一个 GUI 工具,可以将 git 存储库中更改的文件推送到 ftp 服务器。

You can check the changed files in GUI way, and it can save your ftp connection details for future use.

您可以通过 GUI 方式检查更改的文件,并且可以保存您的 ftp 连接详细信息以备将来使用。

回答by Mikel

In your other question, you seem to be using user@hostin your FTP URL.

在您的另一个问题中,您似乎user@host在 FTP URL 中使用。

The docsdon't mention user@as being supported.

文档没有提到user@作为支撑。

回答by Marc Hughes

I don't know if this will work or not, but one thing to look at is .netrc support.

我不知道这是否可行,但要考虑的一件事是 .netrc 支持。

I know on windows, some people here put their HTTP login credentials in a netrc file so they don't have to specify it on the git command. Perhaps FTP can work similarly?

我知道在 Windows 上,这里有些人将他们的 HTTP 登录凭据放在 netrc 文件中,这样他们就不必在 git 命令上指定它。也许FTP可以类似地工作?

I'm on OSX, and that file sits in my home directory. I don't know where it goes on windows.

我在 OSX 上,该文件位于我的主目录中。我不知道它在 windows 上的位置。