git - git远程推送是如何工作的?

标签 git github

git 远程推送功能如何工作?我正在尝试复制 github 的 ssh 推送风格。

最佳答案

GitHub 允许注册 ssh key ,并允许使用 ssh 类型的 url:

<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0d6a64794d6a647965786f236e6260" rel="noreferrer noopener nofollow">[email protected]</a>:user/repo.git

如果您希望自己的服务器遵循此规则,您需要:

  • 正在运行的 ssh 守护进程,其路径中包含 git。
  • 在 git 管理员帐户(例如“git”)authorized_keys 文件中注册您的公钥(请参阅“Git book ”):谨防 the permission issues .
  • 在客户端上声明您的私钥 config file .

然后,您将能够使用 uri yourserver:yourRepo 克隆/推送/pull 您的远程存储库(这将引用您配置的“yourServer”条目)文件)

Will Palmer comments ,您可以在 git 安装中添加一个 authorization 框架名为 gitolite 。请参阅installation page ,或者我的own installation script for a local installation (与“git”帐户位于同一帐户中)

关于git - git远程推送是如何工作的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12755002/

相关文章:

Git制作和master不一样

git - 如何同时在几个分支上工作

ios - 我想在 Swift 中实现 ASMediasFocusDelegate

php - Composer : no matching package found

git - 用户拥有的项目和存储库项目板有什么区别

Git:推送后更改时间戳

git - Git merge 的顺序重要吗?

git checkout 版本,包括子模块

git - 如何在 VS Code 中只提交跟踪的文件?

GitHub - 从我的个人资料中显示的收集贡献中排除某些存储库