def from_cfg_attributes(cls, path, attributes): repo = GitRepo(path) for key, val in attributes.items(): name, key = StrFmt.split_cfg_key(key) remote = Remote(repo, name) if not repo.remotes: # this is the first remote remote.is_canonical = True if not remote.name in repo.remotes: repo.remotes[remote.name] = remote remote = repo.remotes[remote.name] remote.urls[key] = val return repo