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

11,877

Solution 1

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

Solution 2

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"

Solution 3

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.

Share:
11,877
Nayananga Muhandiram
Author by

Nayananga Muhandiram

Updated on July 30, 2022

Comments

  • Nayananga Muhandiram
    Nayananga Muhandiram almost 2 years

    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