Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual studio/GIT : No tracked remote branch

Tags:

I just configured Visual Studio 2015 with a connection to GitHub. Unfortunately, it doesn't work to track the remote branch. I have 2 projects in the same solution, each has its own repository. For each of them, - I only have one branch (Master) - I checked that the remote branch was set correctly (Push and fetch have the same value). I eventually reset the branches - In Synchronization, only "Fetch" is not greyed out. Clicking on it doesn't synchronize. Under "Incoming Commit" is written "The current branch does not track a remote branch". - When working with Git GUI, it works fine, I can easily fetch and push.

Please ask if you need more information.

Thanks

Niko

like image 975
Hermios Avatar asked Nov 11 '16 12:11

Hermios


People also ask

What does track remote branch mean in Visual Studio?

Tracking a remote branch means you want to automatically merge changes from the remote branch you're tracking into your local branch.

How do I stop a remote branch from tracking?

Simply delete your remote tracking branch: git branch -d -r origin/<remote branch name> (This will not delete the branch on the remote repo!) That will make any push/pull completely unaware of origin/.

How do I check my remote tracking branch?

You can check tracking branches by running the “git branch” command with the “-vv” option. We can set the upstream branch using the “git push” command. $ git push -u origin branch Total 0 (delta 0), reused 0 (delta 0) * [new branch] branch -> branch Branch 'branch' set up to track remote branch 'branch' from 'origin'.

How do I find the remote branch in Visual Studio?

Find the remote branch in remotes -> origin , then double-click that branch to get it selected locally.


Video Answer


1 Answers

The UI doesn't make it very clear that you have to use Publish without adding a remote repo.

If you add a remote first, Publish never becomes available and you get stuck in the "does not track a remote branch" state. I've just had the same trouble in VS2017.

Wrong way:

You might think that before you can sync to a remote, you have to tell Visual Studio about the remote. Don't do that.

enter image description here

enter image description here


Right way:

Instead, hit Sync:

enter image description here

Visual Studio detects that there is no remote configured for the repo, and takes you to the Push dialog:

enter image description here

Press the relevant Publish button, and an input box appears. This is the right place to configure Visual Studio with the URL of the remote repo.

When the remote is added this way, Visual Studio recognizes the status of the remote repo so that it no longer thinks it's untracked. From now on, it enables all the sync/push functionality as expected.

like image 114
Reg Edit Avatar answered Sep 18 '22 06:09

Reg Edit