remote: Forbidden fatal: unable to access

14,642

Make sure that username and main-account are the same: you need to push back to a repository that you own (have created as username)

Or you need to have been granted repository access to username by their owner main-account.

Share:
14,642
Fathi
Author by

Fathi

Updated on June 22, 2022

Comments

  • Fathi
    Fathi almost 2 years

    I have access to repo, I clone it by https, then I made my changes and I commit those change and create new_branch and try to push I got this:

    git push origin new_branch
    remote: Forbidden
    fatal: unable to access 'https://[email protected]/main-account/repo.git/': The requested URL returned error: 403
    

    I already setup my SSH key, git global config and already logged

    ssh -T [email protected]
    logged in as username
    
    You can use git or hg to connect to Bitbucket. Shell access is disabled
    

    also, I tried to change the url

    git remote set-url origin [email protected]:main-account/repo.git
    

    and when I push I got this

    git push origin new_branch
    Forbidden
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    

    and finally my ~/.ssh/config

    Host *
            UseKeychain yes
    
    Host bitbucket.org
            HostName bitbucket.org
            PreferredAuthentications publickey
            IdentityFile ~/.ssh/id_rsa
    

    Any help? Thanks in advance