另请参阅我的运行 Powershell。
我的尝试是实施以下工作流程
D:\Projects
我将其添加到注册表中
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Folder\shell\git-clone]
@="Clone here"
[HKEY_CLASSES_ROOT\Folder\shell\git-clone\command]
@="Powershell -NoProfile -Command \"git clone $(Get-Clipboard)\""
这确实会在上下文菜单中添加“克隆此处”,并且它会克隆,但不是在右键单击的目录中,而是在其父目录中。
如何在右键单击的目录中克隆存储库?
感谢@keithmiller提示我找到了解决方案
有效的命令是
Powershell -NoProfile -Command "Set-Location -LiteralPath '%V' ; git clone $(Get-Clipboard)"
可以使用以下
.reg
文件创建注册表项:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\git-clone]
@="Clone here"
[HKEY_CLASSES_ROOT\Directory\shell\git-clone\command]
@="Powershell -NoProfile -Command \"Set-Location -LiteralPath '%V' ; git clone $(Get-Clipboard)\""
我在这里使用目录分支而不是文件夹,因为它可能只适用于真实的文件目录。