shell命令运行时,golang +命令失败

时间:2019-04-24 00:02:44

标签: git shell go

这为什么会失败(错误128,不是有效的存储库):

func main() {
  command_base := "/usr/local/bin/git-upload-pack"
  command_args := []string{"/repos/bar/foo.git"}
  cmd := exec.Command(command_base, command_args...)
  out, err := cmd.CombinedOutput()
  if err != nil {
    log.Fatalf("cmd.Run() failed with %s\n", err)
  }
  fmt.Printf("combined out:\n%s\n", string(out))
}

成功后...

$ /usr/local/bin/git-upload-pack /repos/bar/foo.git
00f262621d854b3299d7f17d6f1523435396cfcf8357 HEADmulti_ack thin-pack side-band side-band-64k ofs-delta shallow deepen-since deepen-not deepen-relative no-progress include-tag multi_ack_detailed symref=HEAD:refs/heads/master agent=git/2.21.0
003f62621d854b3299d7f17d6f1523435396cfcf8357 refs/heads/master
0000

0 个答案:

没有答案