import subprocess
import os


def gh_deploy(config):
    if not os.path.exists('.git'):
        print 'Cannot deploy - this directory does not appear to be a git repository'
        return

    print "Copying '%s' to `gh-pages` branch and pushing to GitHub." % config['site_dir']
    try:
       subprocess.check_call(['ghp-import', '-p', config['site_dir']])
    except:
       return

    url = subprocess.check_output(["git", "config", "--get", "remote.origin.url"])
    url = url.decode('utf-8').strip()
    host, path = url.split('github.com/', 1)
    username, repo = path.split('/', 1)
    if repo.endswith('.git'):
        repo = repo[:-len('.git')]
    print 'Your documentation should shortly be available at: http://%s.github.io/%s' % (username, repo)

@@ -376,24 +376,62 @@
     return%0A%0A
+    # TODO: Also check for CNAME file%0A
     url = su
@@ -539,16 +539,49 @@
 strip()%0A
+    if 'github.com/' in url:%0A    
     host
@@ -613,24 +613,83 @@
 b.com/', 1)%0A
+    else:%0A        host, path = url.split('github.com:', 1)%0A
     username
@@ -781,16 +781,70 @@
 .git')%5D%0A
+    url = 'http://%25s.github.io/%25s' %25 (username, repo)%0A
     prin
@@ -901,47 +901,12 @@
 at: 
-http://%25s.github.io/%25s' %25 (username, repo)
+' + url
 %0A

Support both remote URL styles in gh-deploy.