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

Viewed 18066

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://nayanangamuhandiram@bitbucket.org/group4suoj2016/version-1.0.git' 'nayananga`s_branch'
Password for 'https://nayanangamuhandiram@bitbucket.org': 
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://nayanangamuhandiram@bitbucket.org/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://nayanangamuhandiram@bitbucket.org': 
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://nayanangamuhandiram@bitbucket.org/group4suoj2016/version-1.0.git'

@tim

nayananga@nayananga-Aspire-E5-575G:/opt/lampp/htdocs/registration$ git push origin master
Password for 'https://nayanangamuhandiram@bitbucket.org': 
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://nayanangamuhandiram@bitbucket.org/group4suoj2016/version-1.0.git'

@R

5 Answers

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

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.

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"

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

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.

Related