【问题标题】:Cant push into github from android studio无法从 android studio 推送到 github
【发布时间】:2017-09-22 11:26:40
【问题描述】:

我可以将我的项目添加到一个 github 帐户,但不能使用另一个帐户。我在 GitHub 上关注了这个网站并且工作正常:https://www.londonappdeveloper.com/how-to-use-git-hub-with-android-studio/#comment-32683

步骤是: 1. 创建一个新的 git repo。 2.从android studio-VCS>导入版本控制>创建git repo。 3. 在项目的 windows 根目录中打开 bash 命令并输入 > git remote add origin https://github.com/xxx/myProject.git 4. 然后回到 android studio 和 a)project>Git>add b)project>Git>Commit c) project>Git>repository >推

这些步骤运行良好,我使用一个 github 帐户收到一条成功消息。但是使用另一个帐户我无法做到这一点,我得到了错误:

 Failed with error: fatal: unable to access 'https://github.com/Rashedul/myProject.git/': The requested URL returned error: 403

为什么会发生这种情况以及如何解决?

【问题讨论】:

标签: android git android-studio github


【解决方案1】:

首先你应该设置用户名和密码来访问URL和登录,首先设置身份验证。

git remote set-url origin https://yourusername@github.com/user/repo.git

然后你在尝试git push时会被要求输入密码

这是关于http认证格式的。你也可以设置密码:

https://youruser:password@github.com/user/repo.git

您应该知道,如果您这样做,您的 github 密码将以明文形式存储在您的 .git 目录中,这显然是不可取的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-26
    • 2021-12-28
    • 1970-01-01
    • 2018-02-27
    • 1970-01-01
    相关资源
    最近更新 更多