New version to release later

I have a Flatpak on GitHub which has been published. In the past when I wanted to create a new release I used the web page to create a new tag then uploaded files into it, then released it. (IIRC). I’m now trying to do things properly and have a git directory (local repository?) on my PC and am using Git to update the GitHub repository from it.

I’ve been looking at the Git documentation and finding that it is extremely complex, it’s designed for professionals. I’m not, I need about 1% of it and am not sure which 1%! I want to publish a new version, so I followed the instructions here Managing releases in a repository - GitHub Docs and have created a new release on GitHub which is empty. I now want to push the updated software from my PC to that release on GitHub (not the live earlier version.) This is what I did:

git add all                         {OK}
git commit -m "To V1.5.2 draft"     {OK}
git push origin V1.5.2
*error: src refspec V1.5.2 does not match any error: failed to push some refs to...*

In the last line I was trying to refer to the tag which identifies the release. Perhaps I need to do something like in the following line first to make a link, but the release is empty so it seems pointless.

git pull origin V1.5.2

What do I need to do? Maybe a release doesn’t mean the same as a version, maybe I should be using a branch. Perhaps the answer is “I wouldn’t start from here”.

1 Like

In short, the error message means you’re trying to push a ref (usually branch or tag) that doesn’t exist. After you’ve created the commit that you want to become a release, you need to tag it, e.g.:

git tag -a V1.5.2

After that you can push the tag exactly how you tried to, the key is that the tag must exist locally before you can push it. Note that tags in Git are (generally) not supposed to change, so you should create the tag after you’re done working on the release. If you want to push before (e.g. to run CI jobs) work on a branch and push that.

After pushing the tag you can create the release from the existing tag instead of having GitHub create the tag for you.

See also: Git - Tagging


@airtower-luna Now that is the first clear and helpful advice I’ve had on this :grinning: …and it worked the new version of the application has now been published.
I haven’t found a simple explanation of the Git concepts in general yet, so thanks for your help.