Search code examples
androidgitandroid-studiogithubandroid-studio-2.1

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


I was changed user for github in Android studio and trying to pushing code in repository but its getting error.

Repository successfully creating and commit also but in pushing time getting error.

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

I also tried new project, but still getting old user name denied access error.


Solution

    1. Why don't you push using Android Studio?

    2. Have you got write permission on remote for new user?

    3. Did you changed user in repo too? I think that you still have old data. Check it in project directory

      git config user.name

      git config user.email

    4. You can check this trick

      edit .git/config file under your repo directory

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

      change it from

      url=https://[email protected]/yy/repo_name.git

      to

      url=ssh://[email protected]/your_user_name/repo_name.git.

    5. Alternatively

      1. Create new repo in your remote server <- can be skipped
      2. Remove existing git remote from local project

        git remote rm origin

      3. Add new remote

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

    I have no more idea :)