Using pip, and possibly other tools, you can try using a .netrc[0] file to manage login credentials for private repositories.
Although it is a cleartext file (so you may need to manage access to it, for instance when using it in CI), at least your credentials will not show up in log files.
[0] https://www.gnu.org/software/inetutils/manual/html_node/The-...