The repo belongs to other user. I am able to pull the code. Also able to commit the code.
I am using VS-Code to commit and push code. It asks for the password twice which I enter as needed.
Pushing the code using command-line is also not helping.
I am facing this issue:
> git push origin branch1:branch1
remote: The requested repository either does not exist or you do not have access. If you believe this repository exists and you have access, make sure you're authenticated.
fatal: unable to access '<repo-url>': The requested URL returned error: 403
Also getting this in Output of VS-Code when pushing:
[warning] ENOENT: no such file or directory, open '/home/username/projects/FRONTEND/repo/.git/refs/remotes/origin/branch1'
The above issue comes when I push the code.
So I followed this article The-requested-repository-either-does-not-exist-or-you-do-not which asked me to setup ssh-key as instructed in set-up-personal-ssh-keys-on-linux and different-ssh-keys-multiple-bitbucket-accounts
I have setup the ssh key. In config I have given:
Host bitbucket.org-<user_name>
HostName bitbucket.org
LogLevel DEBUG3
User git
IdentityFile ~/.ssh/<file-name>
IdentitiesOnly yes
This did not help.
Then I followed this article Cannot-push-to-Bitbucket-repository I ran the set-url command. This did not help me either. Still got this:
> git push origin branch1:branch1
remote: The requested repository either does not exist or you do not have access. If you believe this repository exists and you have access, make sure you're authenticated.
fatal: unable to access '<repo-url>': The requested URL returned error: 403
[warning] ENOENT: no such file or directory, open '/home/username/projects/FRONTEND/repo/.git/refs/remotes/origin/branch1'
I checked the user.email and user.name on bash and they are correct.
I am stuck and dont know what to do please help.
EDIT:
I added the ssh remote url:
>git remote set-url origin git@bitbucket.org:<username>/<repository>.git
And then pushed
>git push -u origin branch1
It did not help.
LOGS:
Notice that I have edited my user and repo for privacy
OpenSSH_8.9p1 Ubuntu-3ubuntu0.7, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /home/username/.ssh/config
debug1: /home/username/.ssh/config line 1: Applying options for bitbucket.org
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to bitbucket.org [104.192.141.1] port 22.
debug1: Connection established.
debug1: identity file /home/username/.ssh/ssh-key-bb type 3
debug1: identity file /home/username/.ssh/ssh-key-bb-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.7
debug1: Remote protocol version 2.0, remote software version conker_1e4227a421 4ee5f28ee0db
debug1: compat_banner: no match: conker_1e4227a421 4ee5f28ee0db
debug1: Authenticating to bitbucket.org:22 as 'git'
debug1: load_hostkeys: fopen /home/username/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519
debug1: load_hostkeys: fopen /home/username/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host 'bitbucket.org' is known and matches the ED25519 host key.
debug1: Found key in /home/username/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: get_agent_identities: bound agent to hostkey
debug1: get_agent_identities: agent returned 2 keys
debug1: Will attempt key: /home/username/.ssh/ssh-key-bb
debug1: Will attempt key: <username1>
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ssh-dss-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-rsa,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/username/.ssh/ssh-key-bb
debug1: Server accepts key: /home/username/.ssh/ssh-key-bb
Authenticated to bitbucket.org ([104.192.141.1]:22) using "publickey".
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: filesystem
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: client_input_hostkeys: searching /home/username/.ssh/known_hosts for bitbucket.org / (none)
debug1: client_input_hostkeys: searching /home/username/.ssh/known_hosts2 for bitbucket.org / (none)
debug1: client_input_hostkeys: hostkeys file /home/username/.ssh/known_hosts2 does not exist
debug1: client_input_hostkeys: no new or deprecated keys from server
debug1: Sending environment.
debug1: channel 0: setting env LANG = "en_US.UTF-8"
debug1: Sending command: git-receive-pack '<username2>/repo.git'
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
The requested repository either does not exist or you do not have access. If you believe this repository exists and you have access, make sure you're authenticated.
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2236, received 2216 bytes, in 0.6 seconds
Bytes per second: sent 3853.4, received 3819.0
debug1: Exit status 1
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.