1

I am using TortoiseGit on Windows 10 machine. I cloned a remote repo (a BitBucket one) to my local machine. Now in local repo I have created a tag which I want to push to remote repo. But remote repo now has some changes since I cloned it last time and I dont have those changes in my local repo and I dont want them in my local repo for now.

So I try to push my local tag to remote using TortoiseGit (Right-click on any white space to open right-click menu, then click on TortoiseGit --> Push... menu option, this open Push window, in Push window select the Include Tags option, then click OK button). But TortoiseGit rejected it and give an error

[new tag] v3.2.0.1 -> v3.2.0.1
! [rejected] master -> master (fetch first)
Updates were rejected because the remote contains work that you do not have locally. This is usually caused by another repository pushing to the same ref. You may want to first integrate the remote changes (e.g., 'git pull...') before pushing again. See the 'Note about fast-forwards' in 'git push --help' for details.

git did not exit cleanly (exit code 1) (8203 ms @ 2020-03-04 8:59:45 AM)

How can I solve this issue? I dont want to pull latest data from remote repo to my local repo, I just want to push my local tag to remote and nothing else.

srh
  • 1,661
  • 4
  • 30
  • 57
  • Does this answer your question? [How to only push a specific tag to remote?](https://stackoverflow.com/questions/23212452/how-to-only-push-a-specific-tag-to-remote) – phd Mar 04 '20 at 14:47
  • https://stackoverflow.com/search?q=%5Bgit%5D+push+only+tag – phd Mar 04 '20 at 14:47
  • @phd I was hoping to get answer of how to do it with TortoiseGit – srh Mar 04 '20 at 14:59

2 Answers2

1

From the command line git push origin v3.2.0.1

Edit: Instruction in Tortoisegit

EncryptedWatermelon
  • 4,788
  • 1
  • 12
  • 28
  • It works but preferable if you can tell how to do the same thing with TortoiseGit – srh Mar 04 '20 at 15:00
1

The tag v3.2.0.1 was successfully pushed. master failed due to non-fast-forward.

On the Push window,

  1. Leave all checkboxes unchecked. I guess you checked Push all branches. Don't check it.
  2. Under Ref, fill in both Local and Remote editable drop-down lists with refs/tags/v3.2.0.1. For Local, you could also click the right arrow next to the drop-down list and select RefBrowser and then tags on the left and then double-click v3.2.0.1 on the right. It might be okay to leave Remote blank when the repository is properly configured.
  3. Press OK.

My TortoiseGit is v2.9.0.0.

ElpieKay
  • 27,194
  • 6
  • 32
  • 53
  • In my case: Under _Ref_ section, the `Push all branches` option was unchecked and both the `Local` and `Remote` fields had **master** value. Under _Destination_ section, the `Remote` field had **origin** value. Under _Options_ section, the `Include Tags` and 'Autoload Putty Key' options were only checked. – srh Mar 04 '20 at 15:21
  • @srh `Autoload Putty Key` should be checked if you are using SSH url. In your case, the settings are to push `master` and tags. When you want to push a specific tag only, replacing `master` with `refs/tags/` would be okay. – ElpieKay Mar 04 '20 at 15:50