Can I add comments to a .netrc file?
Asked Answered
C

2

11

I'm using a .netrc file to steamline pushing and pulling code int a git repository. The problem is, I'm using multiple tenants on the same host, with different credentials. I was thinking about commenting out blocs in the .netrc file, depending on which tenant I'm connecting to.

Is this possible?

Thanks!

Clearstory answered 9/7, 2020 at 22:45 Comment(3)
man 5 netrc makes no mention of any comment syntax. Beyond that, you would probably have to either (a) experiment, or (b) look at the source code of the application that uses itAllanadale
What happened when you tried it?Mofette
What - by just trying every conceivable character sequence?Septate
Z
3

you could just add a on-purpose error in the host name, so that it doesnt match

Zelma answered 17/5, 2023 at 10:7 Comment(0)
E
1

No, netrc files do not have comments as alani mentions. You could try to use several netrc files with just one host/tenant config and symlink the one you want to use to $HOME/.netrc.

Emilioemily answered 7/3, 2022 at 23:8 Comment(1)
.netrc must be a regular file. However it's possible to override the default location by the NETRC environment variable (gnu.org/software/inetutils/manual/html_node/…).Cowherd

© 2022 - 2024 — McMap. All rights reserved.