Checking that a Git repository exists on Bitbucket:
git ls-remote https://{bitbucket_app_password}@bitbucket.org/{teamName_or_username}/{repo_name}
Note: the above command will return a reference to your repo if it exists, with the heads related to your available branches inside the repo.
Example of a returned repo reference: 6bd56aec730097365aca5caa\tHEAD\n3bc42968eed7aec730097365ace74a5caa\trefs/heads/dev\n9310985c619745780a206bfc6efba069\trefs/heads/master\n
Checking that a specific Branch exists inside a Git repository on Bitbucket:
git ls-remote https://{bitbucket_app_password}@bitbucket.org/{teamName_or_username}/{repo_name} -b {branch_name}
Note:
If the branch_name exists inside your repo, then it will return a reference to your branch as follow:
34296d7a6bd5673009736ce74a5caa\trefs/heads/dev\n
If the branch_name doesn't exist inside your repo, then it won't return a reference to your branch and will return an empty response.