Option to push disabled in Visual Studio Code

9.4k views Asked by At

I have git integration set up with Visual Studio Code. I can commit just fine (so I think my credentials are set up correctly), and I can use git push from the command-line.

But, for some reason, Sync, Pull, and Push are all disabled (greyed out) in the Git section. What am I missing?

Edit: I'm on Ubuntu 12.04, if that matters.

6

There are 6 answers

1
Bassel On

I simply clicked the bottom right branch menu, as the snapshot below, then click push.

enter image description here

2
John Papa On
git branch --set-upstream-to origin/my_branch

Or

git branch -u origin/my_branch
0
Usman Farooq On

I had this issue with Visual Studio 2022. Simply restarting Visual Studio solved it for me.

1
Clever Neologism On

Edit: I'm on Ubuntu 12.04, if that matters.

It, in fact, does!

I just had this problem today, and solved it only because I had it working in Windows, but broken on Linux, and the repos were setup identically. Ubuntu's apt-get repos don't contain an up-to-date version of the git tools (it's a whole major version behind, wtf?). My guess is they are using flags that differ between the versions when they are getting the remote repo information.

Here's what to do in Ubuntu to add an alternate repository that contains the latest versions of git, and install it:

$ sudo add-apt-repository ppa:git-core/ppa
$ sudo apt-get update
$ sudo apt-get install git

Restart VS Code, and all your git options are now properly enabled.

0
Flo Bayer On
0
ali fuat On

My solution was starting Visual Studio with administrator rights