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/