나는 작은 성공을 통해 자식에게 코드 백업을 자동화하려고 시도하고있다. 이 경우 나는 perl에서 시도하고있다. 현재 문제는 git이 실행될 때 적절한 디렉토리에 있어야한다는 것입니다. (세 번째 줄에주의하십시오.) 오류 : 치명적 : 잘못된 refspec 'dest = c : \ data \ git \ aperio \ Scratch \ src \ rich' 내 디렉토리를 다음과 같이 정의 할 수 있습니까? arg? 또는 디렉터리를 가리키는 환경에서 실행되는 것을 실패 했습니까?Perl에서 힘내 당기기
참고 : 나는 이것이 대부분의 힘내 명령에 문제가 될 것임을 알고 있습니다.
...
@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 origin ");
당신이 구현하고있는 것은 [rsync] (https://en.wikipedia.org/wiki/Rsync)와 하나의'git add .' 호출로 더 잘 할 수 있습니다. – Schwern
처음부터 명령을 작성하거나 (git 또는 shell 문제), Perl (Perl 문제)에서 명령을 실행하는 데 문제가 있습니까? – ikegami