git push -u origin master remote: 权限给用户android studio

git push -u origin master remote: Permission to user android studio

我在 Android studio 中更改了 github 的用户并尝试将代码推送到存储库中但出现错误。

存储库也已成功创建和提交,但在推送时出现错误。

F:\....>git push -u origin master
remote: Permission to abc.in/abc.git denied to olduser.
fatal: unable to access 'https://..../abc.git/': The requested URL returned error: 403

我也尝试了新项目,但仍然出现旧用户名拒绝访问错误。

  1. 你为什么不使用 Android Studio 推送?

  2. 你有新用户的远程写入权限吗?

  3. 你在 repo 中也更改了用户吗?我认为你还有旧数据。在项目目录中查看

    git config user.name

    git config user.email

  4. 你可以看看这个技巧

    edit .git/config file under your repo directory

    find url=entry under section [remote "origin"]

    将其更改为

    url=https://your_user_name@github.com/yy/repo_name.git

    url=ssh://git@github.com/your_user_name/repo_name.git.

  5. 或者

    1. 在您的远程服务器中创建新的 repo <- 可以跳过
    2. 从本地项目中删除现有的 git 远程

      git remote rm origin

    3. 添加新遥控器

      git remote add origin https://github.com/your_user_name/repo.git

我不知道:)