4

When I try on gitlab :

  git push --set-upstream origin master

This is not a repo that I own, I just have access to gitlab. I suspect the repo owner has to give me access.

I get this error:

fatal: unable to access '<somegitrepo_ongitlab.git>': The requested URL returned error: 403

I tried changing the user and email like this:

git config user.name my_gitlabuser
git config user.email my_email

Still getting the same error.... How to solve this?

git remote -v results in:

 origin somegitrepo_ongitlab.git (fetch) 
 origin somegitrepo_ongitlab.git (push)

git remote show origin:

* remote origin
  Fetch URL: somegitrepo_ongitlab.git
  Push  URL: somegitrepo_ongitlab.git
  HEAD branch: master
  Remote branch:
    master new (next fetch will store in remotes/origin)
  Local ref configured for 'git push':
    master pushes to master (local out of date)
bier hier
  • 20,970
  • 42
  • 97
  • 166
  • Looks like you've copy+pated a command to set the remote, without replacing some placeholder text with the url. What is the output of `git remote`? – Tom Lord Nov 26 '17 at 09:56
  • Or did you actually edit the error message before posting it here? – Tom Lord Nov 26 '17 at 09:57
  • see above mate ! – bier hier Nov 26 '17 at 10:03
  • Have a look at `git remote show origin` – Christoph Nov 26 '17 at 10:16
  • have a look @Christoph above – bier hier Nov 26 '17 at 10:24
  • @bierhier I'm still very much unclear whether/how much you have redacted the error message. Does it **literally** say "`somegitrepo_ongitlab.git`"?! Or does it show the full path, i.e. `git@your_server:namespace/your_project.git` - where those are real values, not a copy+pasted placeholder? – Tom Lord Nov 27 '17 at 09:57
  • "I suspect the repo owner has to give me access." < this is really the first thing to confirm. What access have you been given? – JohnFF Feb 02 '22 at 17:47

2 Answers2

1

fatal: unable to access '': The requested URL returned error: 403 As you have developer access for pushing your code to particular project perhaps you are not able to push.. :( You need to add your identity first using

ssh-add ~/.ssh/id_rsa

and again try to push code to project
git push --set-upstream origin branch-name

Vrushali Raut
  • 1,130
  • 1
  • 10
  • 20
0

I think, you did not setup your remote correctly: it should look something like that:

.../test (master)
$ git remote show origin
* remote origin
  Fetch URL: https://github.com/Christoph999/test
  Push  URL: https://github.com/Christoph999/test
  HEAD branch: master
  Remote branch:
    master tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local ref configured for 'git push':
    master pushes to master (up to date)

Perhaps, this answer helps

Christoph
  • 6,841
  • 4
  • 37
  • 89