testman
testman

Reputation: 57

Why can't I push my tag to remote when I created this tag from a branch that's remote?

I've created a tag called v1.0 off of a remote branch called v-2.5 and now I'm trying to push this tag to remote so I can deploy on Jenkins.

When I try to push I get:

fatal: You are not currently on a branch.
To push the history leading to the current (detached HEAD)
state now, use git push origin HEAD:<name-of-remote-branch>

So what I did was git push origin HEAD:v-2.5 but my output is Everything up-to-date. Am I missing something here?

My attempts have been the ones I've been seeing on SO but not sure what I'm doing wrong.

Upvotes: 0

Views: 385

Answers (2)

Code-Apprentice
Code-Apprentice

Reputation: 83527

The message is pretty clear: fatal: You are not currently on a branch. You can fix this by either checking out an existing branch:

git checkout v-2.5

or creating a new one creating a branch:

git checkout -b my-new-branch

Then you can push that branch and any tags on it:

git push --tags origin <branch name>

Upvotes: 0

amer
amer

Reputation: 1672

To push a specific tag:

git push origin v1.0  

Push all tags:

git push origin --tags

Upvotes: 2

Related Questions