The .netrc file contains login and initialization information used by the auto-login process. It generally resides in the user’s home directory, but a location outside of the home directory can be set using the environment variable NETRC. Both locations are overridden by the command line option -N. The selected file must be a regular file, or access will be denied.
用于配置网络登录帐号信息的 ~/.netrc 文件,保存用户名密码,减少输用户名密码。
文件 ~/.netrc 用于设置自动登录时所需要的帐号信息。
下面是一个常用的”netrc”文件的内容:
1 | machine your-git-server |
如果有多个 server 就重复上面的三行, 分别输入对应的服务器、 用户名和密码即可.
或:
1 | machine kekxv.github.io login username password passwd |
每行一条记录default 行匹配所有主机
除了上面的形式,netrc文件还支持另外两个设置:
account:用于指定额外的一个用户密码macdef:用于定义宏
netrc 文件可以用于下列程序:
curlftpgit- 其他
资料参考
- https://github.com/bazelbuild/bazel-buildfarm/issues/756#issuecomment-847890721
- https://www.gnu.org/software/inetutils/manual/html_node/The-_002enetrc-file.html
- https://blog.ohyeahwoo.com/?p=632
- http://www.mavetju.org/unix/netrc.php