I can`t Push the branch to <remote> , along with necessary commits and objects
Asked Answered
M

5

12

Iam getting a result like this every time I try to push. i tried force push,rebase,init nothing worked.

nayananga@nayananga-Aspire-E5-575G:/opt/lampp/htdocs/registration$ git push 'https://[email protected]/group4suoj2016/version-1.0.git' 'nayananga`s_branch'
Password for 'https://[email protected]': 
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (5/5), 1.02 KiB | 1.02 MiB/s, done.
Total 5 (delta 0), reused 0 (delta 0)
remote: 
remote: One of your commit messages is missing a valid issue key:
remote: 
remote:   3517c56: CompleteUserRegistrationUsingPhpAndMysqlDatabase
remote: 
remote: For more information, see https://confluence.atlassian.com/x/ZwjoE.
remote: 
To https://bitbucket.org/group4suoj2016/version-1.0.git
 ! [remote rejected] nayananga`s_branch -> nayananga`s_branch (pre-receive hook declined)
error: failed to push some refs to 'https://[email protected]/group4suoj2016/version-1.0.git'

any help?

nayananga@nayananga-Aspire-E5-575G:/opt/lampp/htdocs/registration$ git push origin 'nayananga`s_branch'
Password for 'https://[email protected]': 
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (5/5), 1.02 KiB | 1.02 MiB/s, done.
Total 5 (delta 0), reused 0 (delta 0)
remote: 
remote: One of your commit messages is missing a valid issue key:
remote: 
remote:   3517c56: CompleteUserRegistrationUsingPhpAndMysqlDatabase
remote: 
remote: For more information, see https://confluence.atlassian.com/x/ZwjoE.
remote: 
To https://bitbucket.org/group4suoj2016/version-1.0.git
 ! [remote rejected] nayananga`s_branch -> nayananga`s_branch (pre-receive hook declined)
error: failed to push some refs to 'https://[email protected]/group4suoj2016/version-1.0.git'

@tim

nayananga@nayananga-Aspire-E5-575G:/opt/lampp/htdocs/registration$ git push origin master
Password for 'https://[email protected]': 
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (5/5), 1.02 KiB | 1.02 MiB/s, done.
Total 5 (delta 0), reused 0 (delta 0)
remote: 
remote: One of your commit messages is missing a valid issue key:
remote: 
remote:   6cfab63: CompleteUserRegistrationUsingPhpAndMysqlDatabase
remote: 
remote: For more information, see https://confluence.atlassian.com/x/ZwjoE.
remote: 
To https://bitbucket.org/group4suoj2016/version-1.0.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://[email protected]/group4suoj2016/version-1.0.git'

@R

Molybdous answered 3/9, 2018 at 15:1 Comment(7)
Why aren't you doing something like git push origin nayanangas_branch` ? Check the documentation for how to do a git push.Palladino
As an aside, was a backtick in a branch name necessary? Sounds like asking for trouble. You even broke Tim's comment ;-)Brassy
@tim I updated the question with that try, still sameMolybdous
@RomainVALERI I updated the question with that try, still sameMolybdous
I removed all branching permissions in bitbucket and I`m the administer of the repo if that mattersMolybdous
Looks like you have a pre-commit hook that is rejecting your commit. On a normal git server, you would just need to change or delete the file hooks/pre-commit. Now you just need to find the bitbucket equivalent of doing that.Bibbie
Thanks to your pointing I able to find the solution to the problem. I`ll answer down here.Molybdous
M
15

After spending a lot of time on this I was able to find the solution.I'll post the solution here

We are receiving reports that some customers are receiving "pre-receive hook declined" errors when attempting to push. We are investigating. If you are experiencing this issue, there is a workaround. As a repository admin, you can go to the repository settings -> "Links" section. Then disable "Require issue keys in commit messages". Posted about 2 months ago. Jul 09, 2018 - 10:52 UTC https://status.bitbucket.org/incidents/j71s01py6mb6

hope it will help others

Molybdous answered 3/9, 2018 at 18:48 Comment(1)
This was the solution to my problem. My team uses BitBucket, so to solve this you'd go to repository settings -> Merge checks -> Disable.Fair
A
11

In my case, I have once committed my code without "Issue Key" in the message and after getting that issue, I committed with "Issue Key" again but still I was getting the same error message.

So the solution is

First Check all your commit logs by the following the command:

git log

By the above command, you will get a list of commit logs. From the list, you can remove your most recent commit by following the command (Warning: Do not remove your commit without taking backup if you are not sure, you might lose your code)

git reset --soft HEAD~1

It removed my commit which was having no "Issue Key" attached to it. Then I commit again and pushed my code like below:

git add .
git commit -m"XXXXX-504: my message"
git push

And it worked for me.


To prove it, start a new branch, change a file and check-in with the message containing only the (JIRA, AzureDevOps, RALLY, etc) ticket ID, eg: CP-54321

Alexandra answered 9/11, 2020 at 7:10 Comment(2)
This should be accepted as correct answer. Removing repository settings is just a workaround.Jurdi
this is the proper answer, the XXXXX-504 should be a issue created in JIRA related with your commitSelfeffacement
V
4

Need to create a link between GIT commit <-> JIRA ticket, so include JIRA ticket ID into the commit message. Example: If JIRA Ticket ID is “PD-0707“, you commit message should like as below.

git commit -m "PD-0707 Resolving GIT key issue"

Vaca answered 11/2, 2021 at 16:34 Comment(0)
S
1

If youre working with Bitbuckets, and pipelines, and youve altered the repository settings...

Make sure you uncheck Require issue keys in commit messages if you go around fooling with things like I did before realizing what it was going to do....

enter image description here

Senhorita answered 24/1, 2022 at 2:51 Comment(0)
M
0

The problem is often encountered when you try to push to a working jira project branch that is tied to an issue-key(e.g T-20, M-5, Z-47). Jira requires you to state the issue key in the comment of your commit message

git commit -m "M-5 added a README file to the repo"

I personally think the error could be worded correctly, but that's what the error states in essence.

Merce answered 2/9, 2022 at 8:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.