1

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

Bryan
  • 14,756
  • 10
  • 70
  • 125
sourabh
  • 19
  • 1
  • 1
  • 7
  • A quick search of https://github.com/4lionintern?tab=repositories reveals that no such repository for Test0000.git actually exists. Have you created it? – Harvey Fletcher Jun 23 '17 at 12:31

8 Answers8

2

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://yourUserName@gitlab.com

username: your gitlab username

password: your gitlab password

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

Mahdieh Shavandi
  • 4,906
  • 32
  • 41
1

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

Ashish Patel
  • 21
  • 1
  • 6
0

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

Sunil P
  • 3,698
  • 3
  • 13
  • 20
0

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.

andzie
  • 53
  • 7
0

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.

parambir singh
  • 224
  • 2
  • 13
  • 2
    After you delete .git folder, try to "Share project on GitHub". it will create a new repository on github and push your code over there.. – Gagan Jun 23 '17 at 12:51
0

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 git@github.com: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
clemens
  • 16,716
  • 11
  • 50
  • 65
browndoor
  • 68
  • 1
  • 8
0

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.

0

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.