需要没有用户名和密码的github

San*_*anx 2 github

我想将项目上传到存储库,但问题是,当我运行命令时:

$ git push -u origin master
Run Code Online (Sandbox Code Playgroud)

它向我展示了如下内容:

Username: 
Password: 
error: The requested URL returned error: 403 while accessing https://github.com/sanxelsanto/books3.git/info/refs

fatal: HTTP request failed
Run Code Online (Sandbox Code Playgroud)

我该怎么做才能避免这样的错误信息?

Von*_*onC 5

对于https地址,git将使用curl并且需要:

$HOME/.netrc
Run Code Online (Sandbox Code Playgroud)

或(对于Windows)a:

%HOME%/_netrc
Run Code Online (Sandbox Code Playgroud)

(已%HOME%定义到您想要的任何目录:HOME默认情况下未定义)
其内容:

machine github.com
login <your_github_login>
password <your_github_password>
Run Code Online (Sandbox Code Playgroud)

请参阅" Git - 如何.netrc在Windows上使用文件来保存用户和密码 ".
" 与github同步 " 中详细介绍了其他参数(特别是如果您位于防火墙后面且需要指定代理).