【发布时间】:2017-12-28 23:19:08
【问题描述】:
我正在尝试使用 shell 脚本在远程服务器上查找 git 分支的名称。我把下面的命令放在了bin目录下的一个脚本里。
git symbolic-ref --short HEAD
当我在另一台机器上使用ssh 执行脚本时
ssh -i keyfile.pem user@ipaddress 'bash -s' /path/to/the/script
我收到一个错误
fatal: Not a git repository (or any of the parent directories): .git
不确定我在哪里做错了。任何帮助将不胜感激。
谢谢。
【问题讨论】:
-
cd /path/to/your/git/repo然后git branch --remote列出远程分支。