diff --git a/src/plugins/git/remotedialog.cpp b/src/plugins/git/remotedialog.cpp
index 98078168291a75aaf00fe4aa51fdf3c0645eb29f..db4cb867594bbe710fb1979416d581d5b4ff0ed3 100644
--- a/src/plugins/git/remotedialog.cpp
+++ b/src/plugins/git/remotedialog.cpp
@@ -118,16 +118,15 @@ RemoteDialog::~RemoteDialog()
 
 void RemoteDialog::refresh(const QString &repository, bool force)
 {
-    if (m_repository == repository && !force)
+    if (m_remoteModel->workingDirectory() == repository && !force)
         return;
     // Refresh
-    m_repository = repository;
-    m_ui->repositoryLabel->setText(StashDialog::msgRepositoryLabel(m_repository));
-    if (m_repository.isEmpty()) {
+    m_ui->repositoryLabel->setText(StashDialog::msgRepositoryLabel(repository));
+    if (repository.isEmpty()) {
         m_remoteModel->clear();
     } else {
         QString errorMessage;
-        if (!m_remoteModel->refresh(m_repository, &errorMessage))
+        if (!m_remoteModel->refresh(repository, &errorMessage))
             VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage);
     }
 }
diff --git a/src/plugins/git/remotedialog.h b/src/plugins/git/remotedialog.h
index 7a8d00900b9edbb6b2fb728b13afd915411b6321..7ab485ef0431fcb576a2c76cfeb1b3e7df3fb8ba 100644
--- a/src/plugins/git/remotedialog.h
+++ b/src/plugins/git/remotedialog.h
@@ -92,8 +92,6 @@ private:
 
     RemoteModel *m_remoteModel;
     RemoteAdditionDialog *m_addDialog;
-
-    QString m_repository;
 };
 
 } // namespace Internal
diff --git a/src/plugins/git/remotemodel.cpp b/src/plugins/git/remotemodel.cpp
index d7ad7a3147de3a38ab13b5121ced7eff4ff12578..b6f0933e7c61fbbf418cd9c97a45e58acb21c280 100644
--- a/src/plugins/git/remotemodel.cpp
+++ b/src/plugins/git/remotemodel.cpp
@@ -177,6 +177,8 @@ void RemoteModel::clear()
 
 bool RemoteModel::refresh(const QString &workingDirectory, QString *errorMessage)
 {
+    m_workingDirectory = workingDirectory;
+
     // get list of remotes.
     QMap<QString,QString> remotesList =
             m_client->synchronousRemotesList(workingDirectory, errorMessage);
@@ -184,7 +186,6 @@ bool RemoteModel::refresh(const QString &workingDirectory, QString *errorMessage
     if (remotesList.isEmpty())
         return false;
 
-    m_workingDirectory = workingDirectory;
     beginResetModel();
     m_remotes.clear();
     foreach (const QString &remoteName, remotesList.keys()) {