Github &引用;“在Windows中克隆”;按钮-它是如何工作的?

Github &引用;“在Windows中克隆”;按钮-它是如何工作的?,github,Github,我很好奇这个按钮是怎么工作的。您能否解释一下,当我单击“在Windows中克隆”按钮时,它知道如何在我的计算机上打开本地应用程序(GitHub)。查看:它在HKCR中注册该操作 <Component Id="Protocol.github_windows" Guid="*"> <RegistryKey Key="github-windows" Root="HKCR"> <RegistryValue Value="URL: Github for

我很好奇这个按钮是怎么工作的。您能否解释一下,当我单击“在Windows中克隆”按钮时,它知道如何在我的计算机上打开本地应用程序(GitHub)。

查看:它在HKCR中注册该操作

  <Component Id="Protocol.github_windows" Guid="*">
    <RegistryKey Key="github-windows" Root="HKCR">
      <RegistryValue Value="URL: Github for Windows Protocol" Type="string" />
      <RegistryValue Name="URL Protocol" Value="" Type="string" />
    </RegistryKey>
    <RegistryKey Key="github-windows\DefaultIcon" Root="HKCR">
      <RegistryValue Value="[INSTALLDIR]GitExtensions.exe" Type="string" />
    </RegistryKey>
    <RegistryKey Root="HKCR" Key="github-windows\shell"/>
    <RegistryKey Root="HKCR" Key="github-windows\shell\open"/>
    <RegistryKey Root="HKCR" Key="github-windows\shell\open\command">
      <RegistryValue Value="&quot;[INSTALLDIR]GitExtensions.exe&quot; %1" Type="string" />
    </RegistryKey>
  </Component>

将采用类似的方法。

这在陆龟的应用中非常相似

这是乌龟的名字

newCmd.Format(_T("/command:clone /url:\"%s\" /hasurlhandler"), (LPCTSTR)url);
它需要注册处理程序

<RegistryValue Root="HKLM" Key="Software\Classes\github-windows\shell\open\command" Value="&quot;[INSTALLDIR]bin\TortoiseGitProc.exe&quot; /urlhandler:&quot;%1&quot;" Type="string" />


谢谢你。我可以看到这创造了。。但是,这是如何要求在我的计算机上打开github的?@Noel,因为您的注册表已注册该协议,以便执行
git克隆
(如果您已安装github for windows)。
<RegistryValue Root="HKLM" Key="Software\Classes\github-windows\shell\open\command" Value="&quot;[INSTALLDIR]bin\TortoiseGitProc.exe&quot; /urlhandler:&quot;%1&quot;" Type="string" />