feat(git): Added remote url type option (#146124)

* feat(git): Added remote url type option

* Modify extension configuration

* Simplified code

Co-authored-by: Joao Moreno <joao.moreno@microsoft.com>
This commit is contained in:
zz
2022-04-05 21:49:50 +08:00
committed by GitHub
parent 80f8b99e3c
commit a8097b5607
6 changed files with 19 additions and 4 deletions

View File

@@ -73,7 +73,9 @@ async function handlePushError(repository: Repository, remote: Remote, refspec:
await repository.renameRemote(remote.name, 'upstream');
// Issue: what if there's already another `origin` repo?
await repository.addRemote('origin', ghRepository.clone_url);
const protocol = workspace.getConfiguration('github').get<'https' | 'ssh'>('gitProtocol');
const remoteUrl = protocol === 'https' ? ghRepository.clone_url : ghRepository.ssh_url;
await repository.addRemote('origin', remoteUrl);
try {
await repository.fetch('origin', remoteName);