git - 设置用户名和密码返回 'github: command not found'

标签 git github github-for-windows

我的工作环境完全可以使用 SSH,但在家里我更倾向于使用 GitHub for Windows 而不是 Git bash,所以这就是它设置为 http 的原因。 .

github --credentials get: github: command not found
Username for 'https://github.com': user
Password for 'https://user@github.com': 
github --credentials store: github: command not found
Already up-to-date.

在哪里可以找到并安装 github命令,这样我就不必每次都输入我的用户名和密码? (我想我可能需要在某处向 PATH 添加一些内容。)

最佳答案

您可以看看这篇非常有用的文章:Set up git .你有一个部分,他们向你解释如何保存你的密码。

没有 Github 可执行文件,因为 Github “只是”一个网站,您看到的消息是 git 尝试自动获取您的凭据(您可以按照上面链接中的指南解决此问题)。


无论如何我都想谈谈 SSH,因为它对到达这里的其他人很有用。

不过,存储密码的更好方法是不使用密码,而是使用 SSH key 。在您的 Github 设置中有一个选项可以添加一个新的,对于 Windows,只需使用 PuttyGen 或替代方法生成一个 key ,导出为 OpenSSH key ,然后复制/粘贴它在Github的文本区。
然后使用 SSH 选项克隆您的存储库:

git clone git@github.com:your_username/your_project.git 

或者,如果您有一个已经存在的存储库,请更改 url ( saw here ):

git remote set-url origin git@github.com:your_username/your_project.git

您将不再需要输入密码,而且非常安全(只要没有人可以访问您的计算机并复制私钥)。

关于git - 设置用户名和密码返回 'github: command not found',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13124141/

相关文章:

git pull 错误 "The requested URL returned error: 503 while accessing"

git - 如何在不重命名存储库目录的情况下重命名 'GitHub desktop' 上的仅限本地存储库

github-for-windows - Windows 版 GitHub 忘记了所有存储库

git - 在 Eclipse 中文件上的棕色星号图标是什么意思?

git - 将遗留代码库从 cvs 转移到分布式存储库(例如 git 或 mercurial)。初始存储库设计所需的建议

Git 无法检测 Windows 10 上的文件更改

github - 如何设置 GitHub Pages 以在不同位置查找 index.html?

推送后github无法访问文件夹

Github-如何在我的本地机器上找到未发布的分支?

git - 只在 git log 修饰中显示 Remote