4

Before, i user A account to push code on Android Studio.Now i logout and change into B account to Push. When pushing error occur:

Push failed: Failed with error: fatal: unable to access 'https://github.com/thangcoder/demo.git/': The requested URL returned error: 403

And below error when i push in command:

$ git push -u origin master
remote: Permission to thangcoder/demo.git denied to trangchongcheng.
fatal: unable to access 'https://github.com/thangcoder/demo.git/': The requested URL returned error: 403

(trangchongcheng is A Account)

Please for me sugest, thank all.

6 Answers 6

2

I got the same error. Here's how you fix it.

The problem was that your git repository was secured with SSH keys.

Login to GitHub > Your repository for the project > Settings tab > Deploy keys

Delete the key/keys assigned for your Desktop.

And try pushing the repository from Android Studio again.

For pushing a repository refer: "How to use GitHub with Android Studio".

This worked for me!

Sign up to request clarification or add additional context in comments.

Comments

0

It's clear you do not have write permission on repo. Please ask thangcoder to add write permission to you.

2 Comments

Sorry so much but How to add write permissio @Ramit
I guess thangcoder is created this repo and he/she can give you write access. If repo is created by you then let me know.
0

Check that your computer has permission to push to that repository.

Here's how you can check:

Login to your github account and direct yourself to this link: https://github.com/settings/keys

Now do you see your machine listed on that link? If not add a key to enable your machine to push to a remote repository.

Here's how you can add a key:

https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/

Comments

0

change your file .git/config

[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = https://你的github用户名:你的github密码@github.com/Pandaring/Demos.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master

1 Comment

Thank you for this code snippet, which might provide some limited, immediate help. A proper explanation would greatly improve its long-term value by showing why this is a good solution to the problem and would make it more useful to future readers with other, similar questions. Please edit your answer to add some explanation, including the assumptions you’ve made.
0

i had this problem, please do this way:

1.git config --global --unset user.name
2.git config --global --unset user.email
3.git remote add origin https://github.com/username/file.git
4.git push -u origin master

after push github asks you username and password from user B

Comments

0

I just had the same problem, finding a solution was time consuming. Actually reading the error is helpfull:

Push failed: Failed with error: fatal: unable to access

well, thats the point. just add the user as an collaborator to the repository.

https://help.github.com/articles/inviting-collaborators-to-a-personal-repository/

Note: adding the user to the organization is not enough.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.