3

I keep trying to push a project to a bitbucket repo but I keep getting 403 errors. not sure why. I am the admin of the project. I have read and write privileges. and yet I cannot push anything to bitbucket.

I have tried googling around for the last 30 minutes but nothing solves it

I have a Mac not windows since that seems to be relevant I only have the one bitbucket account so no multiple accounts issue. there are 0 permissions restrictions it is an empty project with nothing in it or history beyond 5 minutes ago. I have the right git https address as far as I know I am not using mercurial or whatever

so how do I authenticate bitbucket from the terminal and why does Atlassian have 0 helpful resources for this?

zamanada
  • 158
  • 13
  • 1
    Without knowing _how_ the push is being done it's hard to say. Are you using HTTPS? SSH? May you share some commands with their output? – evolutionxbox Oct 22 '20 at 19:23
  • @evolutionxbox I am using https – zamanada Oct 22 '20 at 19:24
  • Are you able to clone the repo? Are you using the correct credentials, the one which has write access? – evolutionxbox Oct 22 '20 at 19:26
  • @evolutionxbox I thought I was using the right credentials but I keep getting this git-credential-osxkeychain thing. I copy the password from my password manager and input it but it shakes and says wrong password. what the hell is going on – zamanada Oct 22 '20 at 19:32
  • May you test the password by typing it instead of copy/paste? It could be the password is wrong? – evolutionxbox Oct 22 '20 at 19:33
  • @evolutionxbox ...it's the password I literally just used to log into bitbucket and create the repo. I just checked and it is in fact the same password that is stored in my keychain and then taken from said keychain and put into the bitbucket login in screen where I then login – zamanada Oct 22 '20 at 19:37
  • I doubt being on a mac has much to do with it, nor git-credential-osxkeychain. – evolutionxbox Oct 22 '20 at 19:42
  • @evolutionxbox well then what else could it be? is there a way to login to bitbucket from the terminal? – zamanada Oct 22 '20 at 19:45
  • To confirm, can you clone the repo, pull from it, and/or push to it? – evolutionxbox Oct 22 '20 at 19:48
  • @evolutionxbox TO CONFIRM: I am downloading an open source project from repo#1 from bitbucket. I am putting it in a folder on my desktop called folder1. It downloads. I am now creating a new repo in bitbucket called myrepo. I login successfully. I take the git clone url and I use all the git add and git push commands. nothing happens. so now I am using source tree. I am trying to push the contents of folder1 to myrepo. when I click push a git-credential keychain thing drops down. I enter the bitbucket password. it does not work. I copy and paste the password to be safe. it does NOT work – zamanada Oct 22 '20 at 19:58
  • Please do not use all caps as if to shout. What happens in the command line? (ignoring sourcetree at the moment). What is the error given by the push command? – evolutionxbox Oct 22 '20 at 20:02
  • @evolutionxbox okay so here's what's happening: I use git clone to download repo 1 onto my desktop in folder1. I use git init to init the repo I create a repo in bitbucket called myrepo once I do git clone url_for_myrepo I get some prompt that says `git: 'credential-osxkeychain' is not a git command. See 'git --help'.` and asks me to enter my password. I enter my password. I do the other stuff and move on to the git push. now my error says: ` ! [rejected] master -> master (fetch first) Updates were rejected because the remote contains work that you do not have locally. ` – zamanada Oct 22 '20 at 20:17
  • After the password is entered I assume there is no 403 error? As for the "rejected master" error, it's because you need to pull first before you push. See [this question](https://stackoverflow.com/questions/13661354/github-for-mac-error-git-credential-osxkeychain-is-not-a-git-command) for more about the "git: 'credential-osxkeychain' is not a git command" error. – evolutionxbox Oct 22 '20 at 20:26
  • This is a frustrating issue. I think there's 2 things happening here. `credential-osxkeychain` is set when it didn't need to be, and [the push is being rejected as it is behind the remote](https://stackoverflow.com/questions/11696295/rejected-master-master-non-fast-forward). – evolutionxbox Oct 22 '20 at 20:41

1 Answers1

0

Regarding your current Git installation, check if one of the answers to "GitHub for Mac error: git: 'credential-osxkeychain' is not a git command" can resolve the issue.

But if not, you can at least unset the credential helper, assuming it was set globally, not by your Git installation.

For that, check where it is defined:

git config --show-origin --show-scope -l|grep helper
git config --global --unset credential.helper

Regarding the push, since you just have created the repository, you can force push it:

git push -f -u origin master
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250