peritus / bumpversion

Version-bump your software with a single command
https://pypi.python.org/pypi/bumpversion
MIT License
1.5k stars 148 forks source link

Not able to use bumpversion. Error in git commit and tag #161

Open CuriousLearner opened 7 years ago

CuriousLearner commented 7 years ago

Hi,

I'm using Mac OS Sierra 10.12.5 and git version is: 2.9.2.

I'm using gpgsign to sign my commits. With the gpgsign turned on, It gives me error:

» bumpversion minor                                                                                                                                                     
Traceback (most recent call last):
  File "/usr/local/bin/bumpversion", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/bumpversion/__init__.py", line 994, in main
    vcs.commit(message=commit_message)
  File "/usr/local/lib/python2.7/site-packages/bumpversion/__init__.py", line 73, in commit
    list(os.environ.items()) + [(b'HGENCODING', b'utf-8')]
  File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 574, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '[u'git', u'commit', u'-F', '/var/folders/16/zkkbtd3n1td1fb0z6lxhk2pw0000gn/T/tmpoxDKyt']' returned non-zero exit status 1

With --no-commit option, I still get an error while tagging.

» bumpversion minor --no-commit                                                                                                                
fatal: Failed to resolve 'HEAD' as a valid ref.
Traceback (most recent call last):
  File "/usr/local/bin/bumpversion", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/bumpversion/__init__.py", line 1004, in main
    vcs.tag(tag_name)
  File "/usr/local/lib/python2.7/site-packages/bumpversion/__init__.py", line 150, in tag
    subprocess.check_output(["git", "tag", name])
  File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 574, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '[u'git', u'tag', u'v0.9.0']' returned non-zero exit status 128

Am I missing something here?

theskumar commented 7 years ago

@CuriousLearner what do you get with --no-tag --no-commit option. Also, can you attach you bumpversion config, it should be available either in .bumpversion or setup.cfg

CuriousLearner commented 7 years ago

@theskumar it works with --no-tag --no-commit option.

The bumpversion config in setup.cfg is as follows:

[bumpversion]
current_version = 0.12.0
commit = True
tag = True

[bumpversion:file:hello_world/__init__.py]

[bumpversion:file:hello_world/templates/rest_framework/api.html]

[bumpversion:file:docs/index.md]

[bumpversion:file:README.md]

[bumpversion:part:release]
optional_value = placeholder
values =
    dev
    placeholder
danmichaelo commented 7 years ago

subprocess.CalledProcessError: Command '[u'git', u'tag', u'v0.8.7']' returned non-zero exit status 128 could mean that the tag already exists.

CuriousLearner commented 7 years ago

@danmichaelo I'm pretty sure the tag does not exist already since this is a brand new repo.

danmichaelo commented 7 years ago

Does it work if you just run git tag v0.8.7 in the repo?

axiaoxin commented 5 years ago

bumpversion: v0.5.3 (using Python v2.7.5) --commit and --tag unable to use!

Traceback (most recent call last): File "/usr/bin/bumpversion", line 11, in sys.exit(main()) File "/usr/lib/python2.7/site-packages/bumpversion/init.py", line 994, in main vcs.commit(message=commit_message) File "/usr/lib/python2.7/site-packages/bumpversion/init.py", line 73, in commit list(os.environ.items()) + [(b'HGENCODING', b'utf-8')] File "/usr/lib64/python2.7/subprocess.py", line 575, in check_output raise CalledProcessError(retcode, cmd, output=output) subprocess.CalledProcessError: Command '[u'git', u'commit', u'-F', '/tmp/tmpbSDEWh']' returned non-zero exit status 1

g1tvinod commented 5 years ago

bumpversion: v0.5.3 (using Python v2.7.5) --commit and --tag unable to use!

Traceback (most recent call last): File "/usr/bin/bumpversion", line 11, in sys.exit(main()) File "/usr/lib/python2.7/site-packages/bumpversion/init.py", line 994, in main vcs.commit(message=commit_message) File "/usr/lib/python2.7/site-packages/bumpversion/init.py", line 73, in commit list(os.environ.items()) + [(b'HGENCODING', b'utf-8')] File "/usr/lib64/python2.7/subprocess.py", line 575, in check_output raise CalledProcessError(retcode, cmd, output=output) subprocess.CalledProcessError: Command '[u'git', u'commit', u'-F', '/tmp/tmpbSDEWh']' returned non-zero exit status 1

I'm facing the same issue.

My bumpversion.cfg file looks like this.

[bumpversion] current_version = 0.3.0 commit = True tag = True

[bumpversion:file:VERSION]

If commit=False, it works awesome. Looking for solution with commit=True

cscetbon commented 5 years ago

any idea what's going on ? same issue here

baffolobill commented 5 years ago

I'm facing the same issue.

My bumpversion.cfg file looks like this.

[bumpversion] current_version = 0.3.0 commit = True tag = True

[bumpversion:file:VERSION]

If commit=False, it works awesome. Looking for solution with commit=True

Had the same problem. Ensure that your VERSION and .bumpversion.cfg files are tracked. If don't, call git add VERSION .bumpversion.cfg.

If it doesn't help, try to manually call printed command from the error message:

subprocess.CalledProcessError: Command '[u'git', u'commit', u'-F', '/tmp/tmpbSDEWh']' returned non-zero exit status 1

git commit -F /tmp/tmpbSDEWh

to find out why git cannot make the commit.

rukmal commented 3 years ago

This is probably caused by the tag already existing locally, so Git throws this message when it attempts to re-create.

To clean your local tags up, see: https://stackoverflow.com/questions/1841341/remove-local-git-tags-that-are-no-longer-on-the-remote-repository

fselmo commented 3 years ago

Manually setting git's signing key worked for me. I'm not sure if I had set it manually in the past and it was still trying to use an old key but posting that here in case it helps someone else.

git config --global user.signingkey {gpg key id}

They key id should be the 8-character key as described here: https://www.eugenemdavis.net/finding-your-gnupg-key-id.html

shahabilb commented 2 years ago

This may be a bug in bump2version. Use the following in the configuration file and it should resolve the problem:

no_sign_tags = True