Skip to content

Commit 8783049

Browse files
Pass repo URL to keyring instead of repo name (#2146)
* fix: pass repo URL to `keyring.get_password()` (closes #1986) * fix: pass repo URL to `keyring.set_password()` when caching creds --------- Co-authored-by: Cary Hawkins <hawkinscary23@gmail.com>
1 parent ca29937 commit 8783049

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/hatch/publish/auth.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ def __get_password(self) -> str:
4646

4747
import keyring
4848

49-
password = keyring.get_password(self._repo, self.username)
49+
keyring_service = self._repo_config["url"]
50+
password = keyring.get_password(keyring_service, self.username)
5051
if password is not None:
5152
return password
5253

@@ -111,4 +112,5 @@ def write_updated_data(self):
111112
if self.__password_was_read:
112113
import keyring
113114

114-
keyring.set_password(self._repo, self.__username, self.__password)
115+
keyring_service = self._repo_config["url"]
116+
keyring.set_password(keyring_service, self.__username, self.__password)

0 commit comments

Comments
 (0)