在以下帖子接收钩下,我在推送到存储库import turtle # Allows us to use turtles
wn = turtle.Screen() # Creates a playground for turtles
alex = turtle.Turtle() # Create a turtle, assign to alex
alex.forward(50) # Tell alex to move forward by 50 units
alex.left(90) # Tell alex to turn by 90 degrees
alex.forward(30) # Complete the second side of a rectangle
wn.exitonclick() # Wait for user to close (or click on) window
发布以下接收脚本,
remote: hooks/post-receive:: syntax error, unexpected $undefined, expecting keyword_do or '{' or '('
在这种情况下,我的远程服务器paswd包含#!bin/bash
while read oldrev newrev ref \
do
ssh user1@ip -pPassword\ 'path/to/the/shell.sh'
end
,我尝试了如下
\
#!bin/bash
while read oldrev newrev ref do
ssh user1@ip -pPassword\ 'path/to/the/shell.sh'
end
答案 0 :(得分:0)
对于bash中的while
循环,您可以:
#!/bin/bash
while read oldrev newrev ref;do
echo $read $oldrev $newrev $ref
done
或
#!/bin/bash
while read oldrev newrev ref
do
echo $read $oldrev $newrev $ref
done
或
#!/bin/bash
while read oldrev newrev rev;do echo $read $oldrev $newrev $ref;done
我不确定ssh
部分是否正确,但是我认为\
不是必需的。
答案 1 :(得分:0)
我不确定ssh部分是否正确
实际上,ssh可能有效,但仍是问题的一部分:
ssh -T user1@ip -pPassword
是否工作.bashrc
或.profile
不会回显一堆字符串,这可能会干扰钩子执行。 li>