If You Can’t Upload Files to GitHub and Receive a 400 Bad Request Error

This problem can occur if GitHub’s servers do not understand the files you are uploading at the moment. This article will help you try and resolve the error.

This problem is usually caused by incorrect URLs used, corruption of the files during upload, data mismatch between browser cache and cookies, browser extensions interfering with your requests, or by uploading files that are too large in size, the last of which is rare.

1. Perform a Force Refresh

This is the first step you try whenever there’s an issue with GitHub. Force refreshing will ignore any cached copies of the page and request a new copy from GitHub. This is relatively easy to do and should resolve this problem.

  • Chrome on Windows: Ctrl + F5
  • Chrome on Mac: Command + Shift + R
  • Firefox on Windows: Ctrl + F5
  • Firefox on Mac: Command + Shift + R
  • Safari: Command + Option + R
  • Microsoft Edge: Ctrl + F5

2. Check the URL

Typos in the URL can also cause this problem. Make sure you typed in the correct URL for the file you are trying to upload.

3. Clear Your Cache

Many websites use cookies to ensure you get the best experience. These files remember your last visit and any pertinent data you input into the site. Cookies can sometimes get corrupted or loaded incorrectly, which can produce that error.

To access your cookies, input the following key combination below:

  • Chrome on Windows: Ctrl + Shift + Delete
  • Chrome on Mac: Command + Shift + Delete
  • Firefox on Windows: Ctrl + Shift + Delete
  • Firefox on Mac: Command + Shift + Delete
  • Safari: Settings > Safari > Clear History and Website Data
  • Microsoft Edge: Command + Shift + Delete

Once you’re there, remove the cookies and cached data. You may need to log in again. If you’re able to upload a file, there may have been a cookie causing the problem.

4. Try a Different Browser or Deactivate Browser Extensions

Try uploading the files from a different browser. Browsers can sometimes send invalid HTTP headers to websites. Additionally, browser extensions can sometimes interfere with GitHub’s operations. Deactivate any extensions that could cause problems and try again. To do this:

  • In Chrome: Settings > More Tools > Extensions > Toggle off all extensions
  • In Firefox: Settings > Add-ons and Themes > Toggle off all extensions
  • In Microsoft Edge: Settings > Extensions > Toggle off all extensions
  • In Safari: Safari > Preferences > Extensions > Toggle off all extensions

Although not uncommon, reinstalling the browser could help.

5. Flush the DNS Cache

The Domain Name System (DNS) links URLs to the IP address of the server hosting the website. Mismatches between your system’s DNS cache and the actual web server can cause this issue. To flush the DNS Cache:

  • In Microsoft Windows:
    1. Type ‘cmd’ into the Windows search box.
    2. Right click the Command Prompt entry in the menu and select Open as Administrator. If you’re asked for an administrator password, enter the password.
    3. Type ‘ipconfig /flushdns’ and hit Enter.
    4. Try uploading the files again.
  • In Mac OS:
    1. Open Terminal.
    2. Type ‘dscacheutil -flushcache’ and hit Enter.
    3. Try uploading the files again.

If it works correctly, there was likely a corruption, outdated data, or mismatch in your DNS cache.

6. Restart your System

If none of the above worked, it may be worthwhile to restart your system. Reboots flush all memories and cached data in memory. When your system loads again, it will reload everything from stored files.

7. Try a different file

Not all filetypes are compatible with GitHub. You can only upload up to 100 files at a time, and this problem can also be caused if you’re trying to upload a file that is too large or the filetype you’re using is incompatible with GitHub.

8. The server could be down or experiencing technical difficulties

If you have an alternate device, try uploading from there. If that doesn’t work, GitHub may be experiencing a service issue. If that’s the case, there’s nothing you can do except wait. The servers may have been overloaded, down or unreachable because of a network issue, or the operators planned a scheduled maintenance where the servers needed to be shut down.


Discover more from Drillimation Systems

Subscribe to get the latest posts sent to your email.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.