WebFaction
Community site: login faq
2
1

I have a git repository on github, and I'd like to move it to WebFaction since I can already host an unlimited number of private repositories on WebFaction for no extra charge beyond the basic hosting plan.

How do I do that?

asked 08 Oct '13, 20:41

ryans ♦♦
5.0k103760
accept rate: 43%

edited 08 Oct '13, 20:42


This should do it:

#!/bin/bash

WEBFACTION_USERNAME=mywfuser
WEBFACTION_DOMAIN=mywfuser.webfactional.com
GITHUB_USERNAME=mygithubuser
WEBFACTION_GIT_APPNAME=git
REPOSITORY_NAME=myrepo

# First create the git repository on WebFaction. Skip this step if already done. (see http://docs.webfaction.com/software/git.html)
ssh ${WEBFACTION_USERNAME}@${WEBFACTION_DOMAIN} "\
  cd /home/${WEBFACTION_USERNAME}/webapps/${WEBFACTION_GIT_APPNAME}/repos &&
  git init --bare ${REPOSITORY_NAME}.git &&
  cd ${REPOSITORY_NAME}.git &&
  git config http.receivepack true"

# clone a mirror of the github repostitory   
mkdir -p $HOME/tmp
cd $HOME/tmp
git clone --mirror git@github.com:${GITHUB_USERNAME}/${REPOSITORY_NAME}.git

# push all branches and tags to the new repository
cd ${REPOSITORY_NAME}.git
git remote add webfaction "${WEBFACTION_USERNAME}@${WEBFACTION_DOMAIN}:webapps/${WEBFACTION_GIT_APPNAME}/repos/${REPOSITORY_NAME}.git"
git push webfaction --all
git push webfaction --tags

# now remove the temporary mirror repository
cd $HOME/tmp
rm -rf ${REPOSITORY_NAME}.git

# now clone the WebFaction git repository (see http://docs.webfaction.com/software/git.html)
git clone ${WEBFACTION_USERNAME}@${WEBFACTION_DOMAIN}:webapps/${WEBFACTION_GIT_APPNAME}/repos/${REPOSITORY_NAME}.git
cd ${REPOSITORY_NAME}
git config http.postBuffer 524288000

# view your handiwork
git log --graph --all --pretty=format:'%Cred%h%Creset - %s -%C(yellow)%d%Creset' --abbrev-commit --

Hope that helps!

permanent link
This answer is marked "community wiki".

answered 08 Oct '13, 21:27

ryans ♦♦
5.0k103760
accept rate: 43%

edited 08 Oct '13, 21:43

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×111
×7

question asked: 08 Oct '13, 20:41

question was seen: 3,969 times

last updated: 08 Oct '13, 21:43

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM