diff --git a/Code/Mantid/Framework/ScriptRepository/inc/MantidScriptRepository/ScriptRepositoryImpl.h b/Code/Mantid/Framework/ScriptRepository/inc/MantidScriptRepository/ScriptRepositoryImpl.h
index 02ab5aa294ecacab94b11194d0cb01164c277be3..ad23b61e30b8c4154d3fd12187913efcf53aa5dc 100644
--- a/Code/Mantid/Framework/ScriptRepository/inc/MantidScriptRepository/ScriptRepositoryImpl.h
+++ b/Code/Mantid/Framework/ScriptRepository/inc/MantidScriptRepository/ScriptRepositoryImpl.h
@@ -161,6 +161,7 @@ private:
   void download_directory(const std::string &);
   void download_file(const std::string &, RepositoryEntry &);
   void updateLocalJson(const std::string &, const RepositoryEntry &);
+  void updateRepositoryJson(const std::string &, const RepositoryEntry &);
 
   /// flag that indicate a valid repository
   bool valid;
diff --git a/Code/Mantid/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp b/Code/Mantid/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp
index 60de05488bc5e65673260c8c4aba20ef1edbf420..bdb5e8d45e01f4cfcd9bbef064f849b007255db5 100644
--- a/Code/Mantid/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp
+++ b/Code/Mantid/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp
@@ -858,6 +858,18 @@ void ScriptRepositoryImpl::upload(const std::string &file_path,
       g_log.information() << "ScriptRepository update local json " << std::endl;
       updateLocalJson(file_path, entry); /// FIXME: performance!
 
+      // add the entry to the repository.json. The
+      // repository.json should change at the
+      // remote repository, and we could just download the new one, but
+      // we can not rely on the server updating it fast enough.
+      // So add to the file locally to avoid race condition.
+      RepositoryEntry &remote_entry = repo.at(file_path);
+      if (!published_date.empty())
+          remote_entry.pub_date = DateAndTime(published_date);
+      remote_entry.status = BOTH_UNCHANGED;
+      g_log.debug() << "ScriptRepository updating repository json " << std::endl;
+      updateRepositoryJson(file_path, remote_entry);
+
     } else
       throw ScriptRepoException(info, detail);
 
@@ -866,6 +878,53 @@ void ScriptRepositoryImpl::upload(const std::string &file_path,
   }
 }
 
+/*
+* Adds an entry to .repository.json
+* This is necessary when uploading a file to keep .repository.json and
+* .local.json in sync, and thus display correct file status in the GUI.
+* Requesting an updated .repository.json from the server is not viable
+* at such a time as it would create a race condition.
+* @param path: relative path of uploaded file
+* @param entry: the entry to add to the json file
+*/
+void ScriptRepositoryImpl::updateRepositoryJson(const std::string &path,
+                                               const RepositoryEntry &entry) {
+                                           
+  ptree repository_json;
+  std::string filename = std::string(local_repository).append(".repository.json");
+  read_json(filename, repository_json);
+
+  ptree::const_assoc_iterator it = repository_json.find(path);
+  if (it == repository_json.not_found()) {
+    boost::property_tree::ptree array;
+    array.put(std::string("author"),
+              entry.author);
+    array.put(std::string("description"),
+              entry.description);
+    std::string directory =
+        (const char *)((entry.directory) ? "true" : "false");
+    array.put(std::string("directory"),
+              directory);
+    array.put(std::string("pub_date"),
+              entry.pub_date.toFormattedString());
+    repository_json.push_back(
+        std::pair<std::string,
+                  boost::property_tree::basic_ptree<std::string, std::string>>(
+            path, array));
+  }
+  
+  g_log.debug() << "Update LOCAL JSON FILE" << std::endl;
+  #if defined(_WIN32) || defined(_WIN64)
+    // set the .repository.json and .local.json not hidden to be able to edit it
+    SetFileAttributes(filename.c_str(), FILE_ATTRIBUTE_NORMAL);
+  #endif
+    write_json(filename, repository_json);
+  #if defined(_WIN32) || defined(_WIN64)
+    // set the .repository.json and .local.json hidden
+    SetFileAttributes(filename.c_str(), FILE_ATTRIBUTE_HIDDEN);
+  #endif
+}
+
 /**
  * Delete one file from the local and the central ScriptRepository
  * It will send in a POST method, with the file path to find the path :