3

I have some outstanding outgoing commits in Visual Studio using Visual Studio Online with Git. I want to push my local repository to my TFS account.

My problem is that the Push option is disabled.

I tried simply adding some comments to create a change and then locally committing that. That would be BaseLine Resend in the image below. I NO had problems with locally committing but the Push option enabled state did not change i.e. it's still disabled.

I would like to know how to recover from this state and it's happened several times before and the only solution seems to be to wipe the repository and start over which is obviously completely unsatisfactory.

enter image description here

Update: Git Config

[core]  bare = false    repositoryformatversion = 0     filemode = false    logallrefupdates = true     symlinks = false    ignorecase = true [diff]    tool = vsdiffmerge [difftool]   prompt = true [difftool "vsdiffmerge"]  cmd = \"C:\\Program Files (x86)\\Microsoft Visual Studio
12.0\\Common7\\IDE\\vsdiffmerge.exe\" \"$LOCAL\" \"$REMOTE\" //t    keepbackup = false  trustexistcode = true [merge]   tool = vsdiffmerge [mergetool]  prompt = true [mergetool "vsdiffmerge"]     cmd = \"C:\\Program Files (x86)\\Microsoft Visual Studio
12.0\\Common7\\IDE\\vsdiffmerge.exe\" \"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\" //m  keepbackup = false  trustexistcode = true [remote "origin"]     url = https://abc.visualstudio.com/DefaultCollection/Abc%20Enterprise/_git/Abc.Enterprise.Tasking   fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"]   remote
= origin    merge = refs/heads/master
Ed Blankenship
  • 5,235
  • 1
  • 31
  • 31
rism
  • 11,932
  • 16
  • 76
  • 116
  • How did you create the repository? Local? Cloned from VSO? You might need to register your VSO uri as a remote git repository for it to be able to push. You need to do this from the git command line or by manually editing your git config file for the repository. See: http://stackoverflow.com/a/20890807/736079 – jessehouwing Mar 05 '14 at 22:42
  • I created it from a local repository. So wrote some code, eventually started using source control in VS, commit to local and then after creating a TFS account was all set to push. But no can do. I have manually checked the config file to ensure the Uri is correct and it was... so at this point Im fed up and just scratched out the git folder and re-added to source control, committed again and now all works fine with sync up to TFS. – rism Mar 05 '14 at 23:17
  • In hindsight I wonder if is something stupid like whitespace? The TFS account gives you the Uri and I just copy pasted it...maybe with some whitespace at the end of it.... bout the only thing i can think of at this point. – rism Mar 05 '14 at 23:18
  • @rism can you post your `.git\config`? – Edward Thomson Mar 05 '14 at 23:22
  • Best way to change these config settings is through the git command line, it will actually try to do a bit of validation :). – jessehouwing Mar 05 '14 at 23:22
  • @EdwardThomson Ok I have updated the post with git config. – rism Mar 06 '14 at 00:35
  • 1
    Oh my; is that a copy / paste issue or is your config really all on one line like there were some white space issues? – Edward Thomson Mar 06 '14 at 02:32
  • @EdwardThomson A while ago now but yes it's all on one line as per Git for Visual Studio / Team Foundation Service. That's how they roll. Can word wrap it in NotePad but if you were using the raw file rather than the command line then one long line is what you're dealing with. – rism Feb 27 '15 at 03:11
  • @rism Ah, well, for what it's worth, that's not how *we* roll... Git for Windows *and* VS use Unix-style newlines, and notepad is a terrible text editor and can't cope. Notepad2, notepad++ or, really, anything, will show this file correctly. – Edward Thomson Feb 27 '15 at 03:16
  • @EdwardThomson A good workman never blames his tools but in this case... time to use some new tools because you're right... the formatting is excellent in VS. I guess that makes *you* the horses mouth. – rism Feb 27 '15 at 03:38

1 Answers1

3

If you need to push your local git for the first time you should run the following (after creating the TFS 2013 git repository):

git remote add origin http://tfs:8080/tfs/...

git push -u origin --all

If you need to commit a specific branch. You should publish this branch. See http://msdn.microsoft.com/en-us/library/jj190809.aspx#publish Until you publish the branch the commits on the branch will stay in "Unpublished branches"

Community
  • 1
  • 1
ziv
  • 3,641
  • 3
  • 21
  • 26