简体   繁体   English

自动GIT克隆

[英]Automated GIT clone

I would like to create either a script that can be executed or an application that will clone several GIT repositories for offsite data backup purposes. 我想创建一个可以执行的脚本或一个将克隆多个GIT存储库以用于异地数据备份的应用程序。 I need this to be able to run on a Windows 7 machine (I'm sure this will add to the complexity of this problem). 我需要它能够在Windows 7计算机上运行(我相信这会增加此问题的复杂性)。

I tried using GIT bash (MINGW shell) and using C# to create the shell and invoke commands to it. 我尝试使用GIT bash(MINGW shell)并使用C#创建shell并对其调用命令。 My tester was working fine until it attempted to supply the password. 我的测试人员在尝试提供密码之前一直工作良好。 It appeared that the password prompt was coming from yet another terminal instance as stdin and stdout were not longer to read and write to the console. 似乎密码提示来自另一个终端实例,因为不再需要对stdin和stdout进行读写操作。 Ideally I would like maintain a simple bash script that could be launched and clone the repositories but I was not able to find anything like that for Windows. 理想情况下,我想维护一个可以启动的简单bash脚本,并克隆存储库,但是我找不到适用于Windows的类似东西。

Any help or insight would be greatly appreciated. 任何帮助或见识将不胜感激。

The ssh keys should be created with no password. ssh密钥不应使用密码创建。 Ensure authorized keys file is updated on the machines you're connecting to. 确保在要连接的计算机上更新授权密钥文件。

Install msysgit and add the proper keys. 安装msysgit并添加适当的密钥。 I'm doing this without any issues. 我这样做没有任何问题。 Make sure to set msysgit to not alter the line endings during it's install. 确保将msysgit设置为在安装过程中不更改行尾。 You can change that later with git config if you forget. 如果您忘记了,可以稍后使用git config进行更改。 Use ssh and not putty. 使用ssh而不是腻子。

Msysgit will give you bash on windows. Msysgit将在Windows上为您提供重击。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM