Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot push to remote with valid app password using https

worship
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 12, 2021

I have set up an account with my own repo (repo1) after being invited from another repo (repo2). I am given a branch from repo2 and have Write, Merge via Pull permissions on the branch in repo2. After receiving the invite from repo2, and accepting, I can see  all the branches on repo2 from my repo1.

I have my own web password and I created an app password for access to the branch that appears on my account on repo1. 

Repo2 is private. It has a master and 3 branches based on master. Mine is 'testBranch'.

I have downloaded (I was unable to clone) the source from 'testBranch'.

After unzipping the download I did the following:

cd to the dir where the unzipped code resides.

git init

git remote add origin <(https:// url that is shown when I select clone with my username)> we'll call it <joe> for brevity.

git add . --verbose

git commit -m "first commit"

git status
On branch master
nothing to commit, working tree clean

git push origin :testBranch

fatal: <joe> does not appear to be a git repository //<-- Ouch!
fatal: Could not read from remote repository.


Please make sure you have the correct access rights
and the repository exists.

git fetch --dry-run --verbose

fatal: <joe> does not appear to be a git repository //<-- Ouch!
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

git push --set-upstream origin master
fatal: <joe>

does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

git remote -v
origin  <joe> (fetch)

origin <joe> (push)

git remote set-url origin <joe>

git remote -v
origin  <joe> (fetch)

origin <joe> (push)

git push --set-upstream origin master

Password for <joe>: *********

remote: You'll need to authenticate with a valid app password. You can create an app password from your account at https://bitbucket.org/account/admin/app-passwords
fatal: unable to access <joe> : The requested URL returned error: 403

At this point from repo1, I added a password for repo1, dutifully saved it so I could add it into config.

vi .git/config // No, one should not put the app password here but I did in order to test it. Shamelessly, I also tried my web log in password out of desperation.

git push origin master

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: repository  <me-the-user:my-app-passsword@joe...> not found

So??? If Admin from repo2 has not setup correct permissions? What are they? 

I can see from tutorials that there should be: User and group access | Write privileges given to me by Admin on repo2. 

Also, Under Workflow | Branch Permissions | Write Access & Merge via pull request

should also be privileges given to me by Admin on repo2.

I confirmed these setting with Admin on repo2. 

Now what? 

What is the trick here where I have repo2 that hosts a private master and provides a branch for me that I can see from my account at repo1?

I thought that a reasonable development model was:

Admin on repo2 holds and protects master. Admin creates a branch for me to use so I don't mess up master.

Admin invites outsider (me) by giving outsider-dev branch access only... with Read/Write to that branch.  (Maybe this is totally wrong??)

outsider-dev makes local changes to code and pushes back to branch owned by Admin on repo2. 

Maybe someone can unconfuse me? I must have the wrong process here. 

I have read too many tutorials... and likely am looking at this upside down. 

Will somebody roll me over?

How difficult should it be to create a master on 1 repo, invite devs to participate using branches created on the master repo and allow devs to update their branches hosted on master repo?

Thanks, any good cookbook steps would really help.

 

 

1 answer

1 vote
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 15, 2021

Hi @worship,

The output of most commands you posted here indicates that there may be an issue with the URL of the remote named origin.

If you're using HTTPS, and run git remote -v, the URL should look as follows (if it also includes your username):

$ git remote -v
origin https://my-username@bitbucket.org/my-workspace/my-repo.git (fetch)
origin https://my-username@bitbucket.org/my-workspace/my-repo.git (push)

where
my-username your Bitbucket username that can be found here: https://bitbucket.org/account/settings/
my-workspace should be the workspace-id of the workspace that owns the repo
my-repo the repository slug

Can you please double-check if the URL you see when you run the command above has that format?

Are you able to access the repo on Bitbucket website, if you navigate to https://bitbucket.org/my-workspace/my-repo (replace my-workspace and my-repo with the values set for the remote URL origin)?

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events