我正在尝试将代码备份自动化为git,但收效甚微.在这种情况下,我在perl中尝试它.我目前的问题是git在运行时希望在正确的目录中.(注意第三行.)我收到错误:致命:无效的refspec'dest = c:\ data\git\aperio\Scratch\src\rich' 有没有办法将我的目录定义为arg?或者在指向目录的环境中运行失败?
注意:我认识到这对大多数git命令都是一个问题,而不仅仅是拉动.
...
@file=("deploy*.bat","deploy.ini","product.lic");
system("$gitexe checkout integrate");
system("$gitexe pull url=https://github.com/Aperio/aperio/Scratch/src/rich dest=c:\\data\\git\\aperio\\Scratch\\src\\rich");
exit if ($testing);
my $message="Changed: ";
foreach $file (@file) {
my ($src,$git,$timestamp,$sb,$message);
my @files = glob($file);
foreach my $f (@files) {
$git=$gitdir."\\rich\\".$f;
say $git;
# Update git if needed
if ((stat($git))[9] < (stat($f))[9]) {
$message.="$f, ";
system("robocopy.exe . $gitdir /R:3 /Z /XO $f"); # Copy file to git folder
system("$gitexe add $gitdir\\rich\\$f");
}
}
}
system("$gitexe commit -m $message");
system("$gitexe status");
system("$gitexe push …Run Code Online (Sandbox Code Playgroud)