Skip to content

Commit 14cc175

Browse files
committed
fix: git remote: change url instead of rm / add
With some repos, there is an issue when the origin url is changed to a fork in repo.yml. Errors look like `unable to read sha1 file of`, `index-pack failed` It's occuring when the remote is removed (git remote rm origin) then added back with another url (git remote add origin <new url>). With this fix, we change the url inplace. `git remote set-url origin <new url>`
1 parent 4a706d7 commit 14cc175

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

git_aggregator/repo.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,8 @@ def _set_remote(self, name, url):
350350
else:
351351
logger.info('Updating remote %s <%s> -> <%s>',
352352
name, exising_url, url)
353-
self.log_call(['git', 'remote', 'rm', name], cwd=self.cwd)
354-
self.log_call(['git', 'remote', 'add', name, url], cwd=self.cwd)
353+
self.log_call(
354+
['git', 'remote', 'set-url', name, url], cwd=self.cwd)
355355

356356
def _github_api_get(self, path):
357357
url = 'https://api.github.com' + path

0 commit comments

Comments
 (0)