我寫了一個真正簡單的Perl腳本來訪問GitHub並設置了一個倉庫,但是我收到了>>fatal: 'origin' does not appear to be a git repository
錯誤。'origin'似乎不是一個git倉庫'
任何有識之士將不勝感激。
#!/usr/bin/perl
use 5.006;
use strict;
#use warnings
my $file;
my $dir;
my $user;
my $email;
my $repo;
print ("Enter your user name\n");
$user = <STDIN>;
chomp $user;
print ("\nEnter your email address\n");
$email = <STDIN>;
chomp $email;
print ("\nEnter a directory path..\n");
$dir = <STDIN>;
chomp ($dir);
sub openDIR{
if (opendir(DIR, $dir)) {
chdir $dir;
print ("You are now in directory >>> ", $dir, "\n");
system 'touch README';
system 'ls -l'
} else {
print ("The directory can not be found, please try again");
die;
}
}
sub git{
print ("Enter the name of the repo you created on Git Hub.\n");
$repo = <STDIN>;
chomp $repo;
system 'git config --global user.name', $user;
system 'git config --global user.email', $email;
system 'git init';
system 'git add README';
system "git commit -m 'first commit'";
system "git remote add origin git\@github.com:", $user,"/", $repo, ".git";
system 'git push origin master'
}
openDIR();
git();
嘗試在添加存儲庫以查看它是否實際添加後停止該程序。 – lc2817
嘗試[Git :: Wrapper](http://search.cpan.org/perldoc/Git::Wrapper) –