Michael
Michael

Reputation: 3366

Copying git tags from one repository to another

I've cloned a repository, changed it's origin and pushed to another server. Made sure to fetch all branches.

Later I realized that I did not push the git tags.

How can I add the original git tags to the new git server.

Upvotes: 9

Views: 5239

Answers (1)

pradeepcep
pradeepcep

Reputation: 932

When you clone a git repository, the tags are automatically copied over to your local repository.

But when you push your local git repository to a remote repository, the tags are not pushed by default. If you want to push only a specific tag, you can use something like

$ git push origin my-tag

Or if you want to push all your tags at once, you can do something like

$ git push origin --tags

Read more: https://git-scm.com/book/en/v2/Git-Basics-Tagging#Sharing-Tags

Upvotes: 11

Related Questions