Skip to content

Instantly share code, notes, and snippets.

@niklasp
Last active January 6, 2017 15:14
Show Gist options
  • Save niklasp/0600ab632f100482578f0cf540889708 to your computer and use it in GitHub Desktop.
Save niklasp/0600ab632f100482578f0cf540889708 to your computer and use it in GitHub Desktop.
1und1 git wordpress local development
#This shows how to setup 1und1 for wordpress development with git
# 1. setup git at 1und1
ssh <your-username>@<your-servername>.1and1-data.host
# 2. go to your wordpress folder usually
cd clickandbuilds/<your-site-name>
# 3. initialize a bare git repo (= without a working tree) and setup a post-receive hook that
# makes changes to your live website
mkdir repo
cd repo
git init --bare
cat > hooks/post-receive << 'EOF'
#!/bin/sh
unset GIT_INDEX_FILE
GIT_WORK_TREE="../" git checkout -f
EOF
# On your LOCAL machine
# 4. clone the repo
ssh://<your-username>@<your-servername>.1and1-data.host/~/clickandbuilds/<your-site-name>/repo <your-desired-folder-name>
cd <your-desired-folder-name>
# 5. add a gitignore file from https://gist.github.com/salcode/9940509
# copy and paste the text from above to a file named .gitignore
# 6. copy the directories you are going to change (wp-content/plugins, wp-content/themes) from remote to your local git
rsync -azP --include='/wp-content/' --include='/wp-content/themes/***' --include='/wp-content/plugins/***' --exclude="*" <your-username>@<your-servername>.1and1-data.host:~/clickandbuilds/<your-site-name>/* .
# 7. add everything and push
git commit -am "initial commit"
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment