remote: Forbidden fatal: unable to access

Viewed 15215

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://username@bitbucket.org/main-account/repo.git/': The requested URL returned error: 403

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

ssh -T username@bitbucket.org
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 git@bitbucket.org: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

3 Answers

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.

Make sure you have an access on Bitbucket.

To check, you can: log into Bitbucket > Profile & settings > Personal setting > App Passwords > Select / grant required access.

To check, you can: log into Bitbucket > Profile & settings > Personal setting > App Passwords > Select / grant required access. > ne token will be generated for you. Make a note of that and use it when you upload / push code to bitbucket.

Related