diff --git a/src/Models/RepositorySettings.cs b/src/Models/RepositorySettings.cs
index 244fc673..4fb96efa 100644
--- a/src/Models/RepositorySettings.cs
+++ b/src/Models/RepositorySettings.cs
@@ -4,6 +4,12 @@ namespace SourceGit.Models
{
public class RepositorySettings
{
+ public string DefaultRemote
+ {
+ get;
+ set;
+ } = string.Empty;
+
public DealWithLocalChanges DealWithLocalChangesOnCheckoutBranch
{
get;
diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml
index 434b3b1a..8f6fac9f 100644
--- a/src/Resources/Locales/en_US.axaml
+++ b/src/Resources/Locales/en_US.axaml
@@ -138,6 +138,7 @@
GIT
Fetch remotes automatically
Minute(s)
+ Default Remote
ISSUE TRACKER
Add Sample Github Rule
Add Sample Jira Rule
diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml
index f26d3e3c..bb39f0f3 100644
--- a/src/Resources/Locales/zh_CN.axaml
+++ b/src/Resources/Locales/zh_CN.axaml
@@ -141,6 +141,7 @@
GIT配置
启用定时自动拉取远程更新
分钟
+ 默认远程
ISSUE追踪
新增匹配Github Issue规则
新增匹配Jira规则
diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml
index ffc46895..ad8f7746 100644
--- a/src/Resources/Locales/zh_TW.axaml
+++ b/src/Resources/Locales/zh_TW.axaml
@@ -141,6 +141,7 @@
Git 設定
啟用定時自動提取 (fetch) 遠端更新
分鐘
+ 預設遠端存放庫
Issue 追蹤
新增符合 GitHub Issue 規則
新增符合 Jira 規則
diff --git a/src/ViewModels/Push.cs b/src/ViewModels/Push.cs
index b3ef694b..acbb1b1d 100644
--- a/src/ViewModels/Push.cs
+++ b/src/ViewModels/Push.cs
@@ -137,9 +137,15 @@ namespace SourceGit.ViewModels
}
}
- // Set default remote to the first if haven't been set.
+ // Set default remote to the first if it has not been set.
if (_selectedRemote == null)
- _selectedRemote = repo.Remotes[0];
+ {
+ var remote = null as Models.Remote;
+ if (!string.IsNullOrEmpty(_repo.Settings.DefaultRemote))
+ remote = repo.Remotes.Find(x => x.Name == _repo.Settings.DefaultRemote);
+
+ _selectedRemote = remote ?? repo.Remotes[0];
+ }
// Auto select preferred remote branch.
AutoSelectBranchByRemote();
diff --git a/src/ViewModels/RepositoryConfigure.cs b/src/ViewModels/RepositoryConfigure.cs
index fe5b1a2f..1f490316 100644
--- a/src/ViewModels/RepositoryConfigure.cs
+++ b/src/ViewModels/RepositoryConfigure.cs
@@ -18,6 +18,24 @@ namespace SourceGit.ViewModels
set;
}
+ public List Remotes
+ {
+ get;
+ }
+
+ public string DefaultRemote
+ {
+ get => _repo.Settings.DefaultRemote;
+ set
+ {
+ if (_repo.Settings.DefaultRemote != value)
+ {
+ _repo.Settings.DefaultRemote = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
public bool GPGCommitSigningEnabled
{
get;
@@ -88,6 +106,10 @@ namespace SourceGit.ViewModels
{
_repo = repo;
+ Remotes = new List();
+ foreach (var remote in _repo.Remotes)
+ Remotes.Add(remote.Name);
+
_cached = new Commands.Config(repo.FullPath).ListAll();
if (_cached.TryGetValue("user.name", out var name))
UserName = name;
diff --git a/src/Views/RepositoryConfigure.axaml b/src/Views/RepositoryConfigure.axaml
index 8d03c0bb..df2ad414 100644
--- a/src/Views/RepositoryConfigure.axaml
+++ b/src/Views/RepositoryConfigure.axaml
@@ -51,7 +51,7 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+