sourabh
sourabh

Reputation: 19

Unable to Push to Github; Error 403

I am unable to push projects to Github using Android Studio. I created a new project as well as a new repository and tried pushing it to Github, but I am getting this error:

Failed with error: fatal: unable to access https://github.com/4lionintern/Test0000.git/: The requested URL returned error: 403

All the questions asked about this have been using git bash, but I am trying to use the commit changes button.

enter image description here

Upvotes: 1

Views: 14509

Answers (8)

Mahdieh Shavandi
Mahdieh Shavandi

Reputation: 8645

I had the same problem. I couldn't push to my own repository!

It was a problem with windows credentials.

  1. Go to: Control panel > User Accounts > credential manager

  2. select: windows credentials

  3. Remove all gitlab credentials you see in the list

  4. Add a generic credential with your gitlab account info:

Internet or network address: git:https://[email protected]

username: your gitlab username

password: your gitlab password

then try to push your changes to the repository again. It should work.

Upvotes: 2

Ashish Patel
Ashish Patel

Reputation: 31

You need to provide write permission to your team member
enter image description here go to member repository permission

Upvotes: 1

Paras Rawat
Paras Rawat

Reputation: 29

Error 403 means : Access not granted. Means github has understood your request but denied your changes

The problem generally occurs when the gitbash account and the github credentials in your android studio do not match. You might have changed the username and password in your android studio but the account in the gitbash remains the same. So you should change the credentials of your gitbash in accordance to the android studio credentials. Change the gitbash credentials in accordance with the android studio credentials and it will definitely work.

Upvotes: 0

Sapna Panda
Sapna Panda

Reputation: 11

You need to first go to: Setting -->System Settings --> passwords --> Select Don't save password.

Next time when you click push, you will be asked for username and password for git repository.Enter your credentials and continue.Hope this helps.

Upvotes: 0

browndoor
browndoor

Reputation: 68

HTTPS doesn't work with Android Studio. I tried re-initializing git using git bash.

In your root folder. Delete old non-working .git folder:

rm -rf .git

Initialize a new empty Git repository. Then add files you want to commit

git init
git add .

Commit and push

git commit -m "first commit"
git remote add origin [email protected]:YourNameHere/YourProjectName.git
git push -u origin master

After that, git should work in Android Studio.

  1. VCS > Git > Commit File...
  2. VCS > Git > Push

Upvotes: 0

parambir singh
parambir singh

Reputation: 330

Go to project folder and Delete .git folder, then try again. If it does not work. Your repository URL may be wrong or the authentication problem.

Upvotes: 0

Sunil P
Sunil P

Reputation: 3848

Try to change the path of git URL from https to SSH, then to reload the project again. Then try to push. Also check credentials given in File>Settings>Version Control>Github

Upvotes: 0

andzie
andzie

Reputation: 53

403 means, that your credentials are wrong or not existing. How are you authenticating at Github? Via Username:Password or public Key. If you use public key, this is not possible via https.

Upvotes: 0

Related Questions