@task
def git_init():

    # Copy the deploy key
    put(config.GIT_PRIV_KEY, '~/.ssh/id_rsa')
    run('chmod 600 ~/.ssh/id_rsa')

    # To avoid testing of the server key (who ask a question)
    append('~/.ssh/config', "Host github.com\n\tStrictHostKeyChecking no\n")

    # Init the repo in ~/gitrepo and pull the folder with the django application
    run('git init ~/gitrepo-plugit')
    with cd('~/gitrepo-plugit'):
        run('git remote add -m ' + config.GIT_BRANCH + ' origin ' + config.GIT_REPO)
        run('git config core.sparsecheckout true')
        append(".git/info/sparse-checkout", config.GIT_PLUGITDIR)
        run('git pull origin ' + config.GIT_BRANCH)
Init the git repository
dataset/ETHPy150Open ebu/radiodns-plugit/Deployment/plugit/plugit_server.py/git_init