diff --git a/lib/platform/bitbucket-server/index.ts b/lib/platform/bitbucket-server/index.ts
index 138b3a509b382f9231dd226657bd0f8b33e8ff4b..56901a18c2a848ff29a342de3654ee8aa1a6433e 100644
--- a/lib/platform/bitbucket-server/index.ts
+++ b/lib/platform/bitbucket-server/index.ts
@@ -723,6 +723,8 @@ export async function findPr(
 
 // Pull Request
 
+const escapeHash = input => (input ? input.replace(/#/g, '%23') : input);
+
 export async function createPr(
   branchName: string,
   title: string,
@@ -743,7 +745,11 @@ export async function createPr(
     )).body;
 
     const defReviewers = (await api.get(
-      `./rest/default-reviewers/1.0/projects/${config.projectKey}/repos/${config.repositorySlug}/reviewers?sourceRefId=refs/heads/${branchName}&targetRefId=refs/heads/${base}&sourceRepoId=${id}&targetRepoId=${id}`
+      `./rest/default-reviewers/1.0/projects/${config.projectKey}/repos/${
+        config.repositorySlug
+      }/reviewers?sourceRefId=refs/heads/${escapeHash(
+        branchName
+      )}&targetRefId=refs/heads/${base}&sourceRepoId=${id}&targetRepoId=${id}`
     )).body;
 
     reviewers = defReviewers.map((u: { name: string }) => ({
diff --git a/lib/platform/bitbucket/index.ts b/lib/platform/bitbucket/index.ts
index 2ae735f1f37f2a8575985e270964d5b632fe9c10..0044ea30642c2063ff44efaf4a15dc32440dece7 100644
--- a/lib/platform/bitbucket/index.ts
+++ b/lib/platform/bitbucket/index.ts
@@ -712,11 +712,15 @@ export function getPrBody(input: string) {
     .replace(/\]\(\.\.\/pull\//g, '](../../pull-requests/');
 }
 
+const escapeHash = input => (input ? input.replace(/#/g, '%23') : input);
+
 // Return the commit SHA for a branch
 async function getBranchCommit(branchName: string) {
   try {
     const branch = (await api.get(
-      `/2.0/repositories/${config.repository}/refs/branches/${branchName}`
+      `/2.0/repositories/${config.repository}/refs/branches/${escapeHash(
+        branchName
+      )}`
     )).body;
     return branch.target.hash;
   } catch (err) /* istanbul ignore next */ {
diff --git a/lib/platform/github/index.ts b/lib/platform/github/index.ts
index 7d47d25d42f8302c1e96987f0be5f23444e9686b..0bfc58a4acfe0333aac4bc30b5602ff3e6381582 100644
--- a/lib/platform/github/index.ts
+++ b/lib/platform/github/index.ts
@@ -73,6 +73,8 @@ const defaults = {
   endpoint: 'https://api.github.com/',
 };
 
+const escapeHash = input => (input ? input.replace(/#/g, '%23') : input);
+
 export async function initPlatform({
   endpoint,
   token,
@@ -431,7 +433,7 @@ export async function getRepoForceRebase() {
 async function getBranchCommit(branchName: string) {
   try {
     const res = await api.get(
-      `repos/${config.repository}/git/refs/heads/${branchName}`
+      `repos/${config.repository}/git/refs/heads/${escapeHash(branchName)}`
     );
     return res.body.object.sha;
   } catch (err) /* istanbul ignore next */ {
@@ -459,7 +461,7 @@ async function getBranchProtection(branchName: string) {
     return {};
   }
   const res = await api.get(
-    `repos/${config.repository}/branches/${branchName}/protection`
+    `repos/${config.repository}/branches/${escapeHash(branchName)}/protection`
   );
   return res.body;
 }
@@ -574,7 +576,9 @@ export async function getBranchStatus(
     logger.warn({ requiredStatusChecks }, `Unsupported requiredStatusChecks`);
     return 'failed';
   }
-  const commitStatusUrl = `repos/${config.repository}/commits/${branchName}/status`;
+  const commitStatusUrl = `repos/${config.repository}/commits/${escapeHash(
+    branchName
+  )}/status`;
   let commitStatus;
   try {
     commitStatus = (await api.get(commitStatusUrl)).body;
@@ -595,7 +599,9 @@ export async function getBranchStatus(
   let checkRuns: { name: string; status: string; conclusion: string }[] = [];
   if (!config.isGhe) {
     try {
-      const checkRunsUrl = `repos/${config.repository}/commits/${branchName}/check-runs`;
+      const checkRunsUrl = `repos/${config.repository}/commits/${escapeHash(
+        branchName
+      )}/check-runs`;
       const opts = {
         headers: {
           Accept: 'application/vnd.github.antiope-preview+json',