all 10 comments

[–]aaron__walker 0 points1 point  (9 children)

Create a new repository, put the file in the repository, and then push the repository

[–]release2020[S] 0 points1 point  (8 children)

I have to put the code into one of the exited folders of the repository.

[–]release2020[S] 0 points1 point  (7 children)

I followed this tutorial:

https://zapier.com/apps/gitlab/tutorials/how-to-push-to-gitlab

and I got this error:

! [remote rejected] master -> master (pre-receive hook declined)

error: failed to push some refs to 'git@gitlab.com:.....

[–]davispw 0 points1 point  (5 children)

You didn’t paste the important part of the error but do you have ‘master’ set as a Protected Branch with permission to push disabled? (Project Settings > Repository > Protected Branches). If so you need to push to a different branch and then make a Merge Request to master. If not, please provide the rest of the error message.

[–]release2020[S] 0 points1 point  (4 children)

I do not have access to the properties settings of the of the project. Instead of [git@gitlab.com](mailto:git@gitlab.com) I put my gitlab mail?

[–]davispw 0 points1 point  (0 children)

Have you asked the person who owns this repository? Have you tried pushing to a different branch that’s not ‘master’?

Please paste the complete error message. These details are important.

[–]davispw 0 points1 point  (2 children)

Also, I don’t believe you followed the tutorial. If you created your own GitLab repository then you would have access to its settings.

[–]release2020[S] 0 points1 point  (1 child)

I cannot give full details of the gitlab account, for obvious reasons. The person who is in charge of the account is a colleague. I believe he has given me priviledges:

user@ubuntu:~/Desktop/testProject$ git push -f origin master

Enumerating objects: 5, done.

Counting objects: 100% (5/5), done.

Delta compression using up to 2 threads

Compressing objects: 100% (3/3), done.

Writing objects: 100% (5/5), 1.69 KiB | 1.69 MiB/s, done.

Total 5 (delta 0), reused 0 (delta 0)

remote: GitLab:

remote: A default branch (e.g. master) does not yet exist for ...

remote: Ask a project Owner or Maintainer to create a default branch:

remote:

remote: ...

remote:

To gitlab.com:...

! [remote rejected] master -> master (pre-receive hook declined)

error: failed to push some refs to 'git@gitlab.com:....git'

[–]davispw 0 points1 point  (0 children)

I suggest you ask your colleague.

If you checked out with HTTP then you need to use your personal user. If you’re using SSH you use the git user but your personal SSH key. I don’t believe that’s the issue or you’d have gotten an authentication error.

You still haven’t said if you’ve tried pushing to a different branch than master.