我试图通过构建脚本来自动化与Git的交互。git获取和重新绑定的bash脚本
我想
与.PEM Amazon实例连接文件
从Ubuntu的实例
运行Git命令我在shell编程一个beginer 。我可以给一个尝试做它喜欢
#!/bin/bash
GIT_REPO='git_repo'
BRANCH='branch'
ssh -i ~/Downloads/4EBDBInstance.pem [email protected]
cd $GIT_REPO
git fetch -a
git checkout $BRANCH
git rebase origin/$BRANCH
我得到了一个错误
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/PATH/Instance_key.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: PATH/Instance_key.pem
Permission denied (publickey).
其实我试图执行以下UNIX在bash文件
$sudo ssh -i PATH/instance_key.pem [email protected]
$cd git_repo
$git fetch -a
$git checkout master
$git rebase origin/master
(note:- need to inform with a message if any conflicts occurs and continue)
$sudo ssh -i PATH/instance_key.pem [email protected]
$cd git_repo
$git fetch -a
$git checkout release
$git rebase origin/release
(note:- need to inform with a message if any conflicts occurs)
任何帮助的命令执行它
壳体分配在等号周围不能有空格。所以'GIT_REPO ='git_repo''需要'GIT_REPO = git_repo'(在这种情况下引号不需要)。 – 2014-12-02 14:31:18
来自ssh的错误正是它所说的。 '/ PATH/Instance_key.pem'上的权限太开放了。你需要修复它们。 – 2014-12-02 14:32:04
修正密钥文件的权限,就像警告所说的那样。另外,在一个脚本中运行'ssh'后跟一堆命令不会*意味着在服务器上运行这些命令。 – Biffen 2014-12-02 14:32:30