prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Publish personal GitHub pages
  I've switched over to using mkdocs for [my personal page](http://jiahao.github.io) and am really liking the output.
  
  I'd like to request that `gh-deploy` be extended to support personal GitHub pages also. Unlike project pages, personal pages must have repository names `<username>.github.io`, and the project is published to the `master` branch instead of `gh-pages`. Everything works fine if I do it manually so I presume supporting personal pages automatically should not be too difficult.
  
  Edit: I have a hacky Makefile that emulates `gh-deploy` (assumes that the markdown source is on a branch called `mkdocs` and deploys to `master`):
  
  ``` make
  site:
      git checkout mkdocs
      mkdocs build
      git checkout master
      cp -R site/* .
      rm -rf site
      echo Ready to commit and push
  ```
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `mkdocs/gh_deploy.py`
  Content:
  ```
  1 from __future__ import print_function
  2 import subprocess
  3 import os
  4 
  5 
  6 def gh_deploy(config):
  7     if not os.path.exists('.git'):
  8         print('Cannot deploy - this directory does not appear to be a git repository')
  9         return
  10 
  11     print("Copying '%s' to `gh-pages` branch and pushing to GitHub." % config['site_dir'])
  12     try:
  13         subprocess.check_call(['ghp-import', '-p', config['site_dir']])
  14     except:
  15         return
  16 
  17     # Does this repository have a CNAME set for GitHub pages?
  18     if os.path.isfile('CNAME'):
  19         # This GitHub pages repository has a CNAME configured.
  20         with(open('CNAME', 'r')) as f:
  21             cname_host = f.read().strip()
  22         print('Based on your CNAME file, your documentation should be available shortly at: http://%s' % cname_host)
  23         print('NOTE: Your DNS records must be configured appropriately for your CNAME URL to work.')
  24         return
  25 
  26     # No CNAME found.  We will use the origin URL to determine the GitHub
  27     # pages location.
  28     url = subprocess.check_output(["git", "config", "--get", "remote.origin.url"])
  29     url = url.decode('utf-8').strip()
  30 
  31     host = None
  32     path = None
  33     if 'github.com/' in url:
  34         host, path = url.split('github.com/', 1)
  35     elif 'github.com:' in url:
  36         host, path = url.split('github.com:', 1)
  37 
  38     if host is None:
  39         # This could be a GitHub Enterprise deployment.
  40         print('Your documentation should be available shortly.')
  41     else:
  42         username, repo = path.split('/', 1)
  43         if repo.endswith('.git'):
  44             repo = repo[:-len('.git')]
  45         url = 'http://%s.github.io/%s' % (username, repo)
  46         print('Your documentation should shortly be available at: ' + url)
  47
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/mkdocs/gh_deploy.py b/mkdocs/gh_deploy.py
  --- a/mkdocs/gh_deploy.py
  +++ b/mkdocs/gh_deploy.py
  @@ -4,13 +4,17 @@
   
   
   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']])
  +        command = ['ghp-import', '-p', config['site_dir']]
  +        if 'remote_branch' in config:
  +            command.extend(['-b', config['remote_branch']])
  +        subprocess.check_call(command)
       except:
           return
  
verification_info: {"golden_diff": "diff --git a/mkdocs/gh_deploy.py b/mkdocs/gh_deploy.py\n--- a/mkdocs/gh_deploy.py\n+++ b/mkdocs/gh_deploy.py\n@@ -4,13 +4,17 @@\n \n \n def gh_deploy(config):\n+\n     if not os.path.exists('.git'):\n         print('Cannot deploy - this directory does not appear to be a git repository')\n         return\n \n     print(\"Copying '%s' to `gh-pages` branch and pushing to GitHub.\" % config['site_dir'])\n     try:\n-        subprocess.check_call(['ghp-import', '-p', config['site_dir']])\n+        command = ['ghp-import', '-p', config['site_dir']]\n+        if 'remote_branch' in config:\n+            command.extend(['-b', config['remote_branch']])\n+        subprocess.check_call(command)\n     except:\n         return\n", "issue": "Publish personal GitHub pages\nI've switched over to using mkdocs for [my personal page](http://jiahao.github.io) and am really liking the output.\n\nI'd like to request that `gh-deploy` be extended to support personal GitHub pages also. Unlike project pages, personal pages must have repository names `<username>.github.io`, and the project is published to the `master` branch instead of `gh-pages`. Everything works fine if I do it manually so I presume supporting personal pages automatically should not be too difficult.\n\nEdit: I have a hacky Makefile that emulates `gh-deploy` (assumes that the markdown source is on a branch called `mkdocs` and deploys to `master`):\n\n``` make\nsite:\n    git checkout mkdocs\n    mkdocs build\n    git checkout master\n    cp -R site/* .\n    rm -rf site\n    echo Ready to commit and push\n```\n\n", "before_files": [{"content": "from __future__ import print_function\nimport subprocess\nimport os\n\n\ndef gh_deploy(config):\n    if not os.path.exists('.git'):\n        print('Cannot deploy - this directory does not appear to be a git repository')\n        return\n\n    print(\"Copying '%s' to `gh-pages` branch and pushing to GitHub.\" % config['site_dir'])\n    try:\n        subprocess.check_call(['ghp-import', '-p', config['site_dir']])\n    except:\n        return\n\n    # Does this repository have a CNAME set for GitHub pages?\n    if os.path.isfile('CNAME'):\n        # This GitHub pages repository has a CNAME configured.\n        with(open('CNAME', 'r')) as f:\n            cname_host = f.read().strip()\n        print('Based on your CNAME file, your documentation should be available shortly at: http://%s' % cname_host)\n        print('NOTE: Your DNS records must be configured appropriately for your CNAME URL to work.')\n        return\n\n    # No CNAME found.  We will use the origin URL to determine the GitHub\n    # pages location.\n    url = subprocess.check_output([\"git\", \"config\", \"--get\", \"remote.origin.url\"])\n    url = url.decode('utf-8').strip()\n\n    host = None\n    path = None\n    if 'github.com/' in url:\n        host, path = url.split('github.com/', 1)\n    elif 'github.com:' in url:\n        host, path = url.split('github.com:', 1)\n\n    if host is None:\n        # This could be a GitHub Enterprise deployment.\n        print('Your documentation should be available shortly.')\n    else:\n        username, repo = path.split('/', 1)\n        if repo.endswith('.git'):\n            repo = repo[:-len('.git')]\n        url = 'http://%s.github.io/%s' % (username, repo)\n        print('Your documentation should shortly be available at: ' + url)\n", "path": "mkdocs/gh_deploy.py"}], "after_files": [{"content": "from __future__ import print_function\nimport subprocess\nimport os\n\n\ndef gh_deploy(config):\n\n    if not os.path.exists('.git'):\n        print('Cannot deploy - this directory does not appear to be a git repository')\n        return\n\n    print(\"Copying '%s' to `gh-pages` branch and pushing to GitHub.\" % config['site_dir'])\n    try:\n        command = ['ghp-import', '-p', config['site_dir']]\n        if 'remote_branch' in config:\n            command.extend(['-b', config['remote_branch']])\n        subprocess.check_call(command)\n    except:\n        return\n\n    # Does this repository have a CNAME set for GitHub pages?\n    if os.path.isfile('CNAME'):\n        # This GitHub pages repository has a CNAME configured.\n        with(open('CNAME', 'r')) as f:\n            cname_host = f.read().strip()\n        print('Based on your CNAME file, your documentation should be available shortly at: http://%s' % cname_host)\n        print('NOTE: Your DNS records must be configured appropriately for your CNAME URL to work.')\n        return\n\n    # No CNAME found.  We will use the origin URL to determine the GitHub\n    # pages location.\n    url = subprocess.check_output([\"git\", \"config\", \"--get\", \"remote.origin.url\"])\n    url = url.decode('utf-8').strip()\n\n    host = None\n    path = None\n    if 'github.com/' in url:\n        host, path = url.split('github.com/', 1)\n    elif 'github.com:' in url:\n        host, path = url.split('github.com:', 1)\n\n    if host is None:\n        # This could be a GitHub Enterprise deployment.\n        print('Your documentation should be available shortly.')\n    else:\n        username, repo = path.split('/', 1)\n        if repo.endswith('.git'):\n            repo = repo[:-len('.git')]\n        url = 'http://%s.github.io/%s' % (username, repo)\n        print('Your documentation should shortly be available at: ' + url)\n", "path": "mkdocs/gh_deploy.py"}]}