ama*_*ard 2 curl github-api git-bash
我正在关注GitHub 的使用 API的教程。在我的 Git Bash 命令提示符中,我输入以下内容
curl -i https://api.github.com/users/defunkt
Run Code Online (Sandbox Code Playgroud)
这会像预期的那样引入 JSON。但是,当我输入
curl -i -u your_username https://api.github.com/users/defunkt
Run Code Online (Sandbox Code Playgroud)
它只是打印一个新行,好像在等我完成命令什么的。我需要按下CTRL C才能逃脱。我也尝试过不同的变体,
curl -i -u "your_username" https://api.github.com/users/defunkt
curl -i --user your_username https://api.github.com/users/defunkt
curl -i --user "your_username" https://api.github.com/users/defunkt
curl -i -user your_username https://api.github.com/users/defunkt
curl -i -user "your_username" https://api.github.com/users/defunkt
Run Code Online (Sandbox Code Playgroud)
没有任何效果。我究竟做错了什么?
结果证明这是一个已知问题(https://github.com/curl/curl/issues/573)。
解决方法:在 curl 命令前加上“winpty”。IE
winpty curl ...
Run Code Online (Sandbox Code Playgroud)