We have some web sites which must be updated from Git repositories by users who have no other permissions on web server. For this task, I imported SSH key to server for authorizing on bitbucket and wrote a simple bash script for four different repos:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash
 
while true; do
echo "Please choose api to update (enter number)"
select repo in "dev" "a" "b" "test" "EXIT"; do
    case $repo in
        dev ) cd /web/dev;echo "updating:";pwd;git pull origin master; break;;
        a ) cd /web/a;echo "updating:";pwd;git pull origin master; break;;
        b) cd /web/b;echo "updating:";pwd;git pull origin master; break;;
        test ) cd /web/test;echo "updating:";pwd;git pull origin master; break;;
        EXIT ) exit;break;;
    esac
done
echo "Update finished. Want to update more?"
echo ""
done

This bash script is set as login shell for those users – so they can login and update their servers.