본문 바로가기

Linux

Git Pull All Repository

@markdown

#Git Pull All Subdirectories


현재 디렉토리 내의 모든 자식 디렉토리에 대해 git pull을 시행한다.

매번 같은 패스워드를 입력하기 귀찮기 때문에 처음 한번만 패스워드를 입력받도록 해두었다.


```

#!/bin/bash


base=$PWD

read -s -p 'Enter git password: ' pass

echo ''


for repo in `ls`; do

    if [ ! -e $base/$repo/.git ]; then

        continue

    fi  

    expect << EOD

        spawn git -C $base/$repo pull

        expect "Password*"

        sleep 1

        send "$pass\r"

        expect eof

EOD

done

```

'Linux' 카테고리의 다른 글

ttylinux live USB 만들기  (0) 2017.02.15
DHCP Client 설치  (0) 2017.01.24
Bash scrtipting  (0) 2017.01.10
Bash file check  (0) 2017.01.07
Linux network interface configuration  (0) 2016.12.27