Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
721 views
in Technique[技术] by (71.8m points)

visual studio - Publish local Git repository to Team Foundation Service

About a week ago Git support was added to Visual Studio 2012 and Team Foundation Service. I've been playing around with it a bit and wanted to publish a local repository to my team project. It's described in step 2 on the Team Foundation Service website:

  • Publish your local Git repository into your new team project.

enter image description here enter image description here

Now I've been doing the exact same thing, but I don't get the "Publish to ..." context item. Could this be a bug or am I missing something?

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I was having the same problem. I don't know why.

However, after a bit of playing around, I managed to get the following working. Disclaimer: can't guarantee this is actually the correct way to do it. It may bork things further. And whether it does the same as what the missing 'Publish' menu item is supposed to do, I have no idea. Use at your discretion...

  • Get the url of your git repo in the project you set up in TFS.
  • Edit the .git/config file on your local repo.
    • Configure the origin remote to point to your TFS repo.
    • (note: if you already had an origin remote, you might want to rename that first to keep it)

e.g.

[remote "origin"]
    url = https://user.visualstudio.com/DefaultCollection/_git/YourRepo
    fetch = +refs/heads/*:refs/remotes/origin/*
  • Open your solution in Visual Studio.
  • Edit a file.
  • Do a commit.
  • Do a push.

This should hopefully push your local repo to your TFS remote as origin.

From here things seem to be working for me -- the code is up in my TFS web interface at least, and I can push commits to it. I can add backlog items etc. I'm new to TFS though so not sure if it's actually all working as it should be.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...