如何注销一个Github帐户并使用其他帐户? [英] how to log out of one Github account and use another account?

查看:1706
本文介绍了如何注销一个Github帐户并使用其他帐户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用另一个github帐户进行练习,现在我建立了自己的github帐户。我从现在开始主要使用我自己的帐户。我的问题是我的电脑仍然以另一个github帐户名登录(即使我在线登录了我自己的Github帐户)。



我无法将任何内容推送到我自己的github回购站,因为显然,其他帐户无权执行此操作。如何告诉我的电脑切换到我自己的帐户,以便我可以在Github在线上推送到我的回购站?

解决方案

如果您使用OSX,请打开终端并运行此命令:

 git凭证-osxkeychain擦除
主机= github.com
协议= https

擦除钥匙串条目。所以下次它会提示你登录。



要查看缓存的当前凭证,请使用命令 git credential-osxkeychain get 然后按两次输入。

如果您只按一次Enter键,您将调用该命令,但它会挂起,如果再次按下Enter键,将会有一个对话框提示您框中确认对钥匙链的访问权限,然后信息将在终端中返回。
$ b b
$ b

如果您想要为了避免将来出现这个问题,您可以配置osx-keychain的git helper工具来存储与存储库的整个路径相关联的登录凭证,而不仅仅是缺省的域名。



在终端输入命令

  git config --global --edit 

这将打开一个配置文件。如果你还没有,你可能需要设置你的默认编辑器,以便在你喜欢的应用程序中打开该文件。例如,将Sublime Text设置为默认编辑器: git config --global core。编辑器subl -n -w



打开配置文件后,搜索 useHttpPath (或者如果它不存在则定义它)。并将其值设置为 true 。它应该是这样的:

pre code $ [证书]
helper = osxkeychain
useHttpPath = true

这将指示git(以及github)用于登录的任何凭证只应与完整的存储库关联被查询的路径,而不是整个域(在github的情况下)Github.com上的所有仓库。所以现在你可以登录到你的仓库,并且你的男朋友可以登录到他的仓库,请勿在您的登录之间发生冲突。


I was using another github account to practice, and now I set up my own github account. I will be primarily using my own account from now on. My problem is that my computer still is logged in as another github account name (even though I am logged into my own Github account online).

I cannot push anything to my own github repos, because the other account does not have permission to do that, obviously. How do I tell my computer to switch over to my own account so that I can push to my repos in Github online?

解决方案

If your using OSX, open terminal and run this:

git credential-osxkeychain erase
host=github.com
protocol=https

to erase the keychain entry. So next time it will prompt you to login.

To view the current credentials cached use the command git credential-osxkeychain get followed by pressing enter twice.

if you press enter only once you will invoke the command but it will apear to hang, if you press enter a second time you will be prompted by a dialog box to confirm access to your keychain and then the information will be returned in terminal


If you would like to prevent this issue in the future you can configure the git helper tool for osx-keychain to store your login credentials associated with the entire path of the repository rather than just the domain which is the default.

In terminal enter the command

git config --global --edit

This will open a configuration file. If you haven't already, you may want to set your default editor so the file opens in your preferred application.. For example, to set Sublime Text as your default editor: git config --global core.editor "subl -n -w"

With the config file opened, search for useHttpPath (or define it if it doesn't exist). And set it's value to true. It should look like this:

[credential]
  helper = osxkeychain
  useHttpPath = true

This will instruct git (as well as github) that any credentials used to login should only be associated with the full repository path that was queried, not for the entire domain (in the case of github) all repositories on Github.com.. So now you can be logged into your repository, and your boyfriend can be logged into his repository and there will be no conflicts between your logins.

这篇关于如何注销一个Github帐户并使用其他帐户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆