ashes999
ashes999

Reputation: 10163

Option to push disabled in Visual Studio Code

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.

Upvotes: 8

Views: 11409

Answers (6)

ali fuat
ali fuat

Reputation: 21

My solution was starting Visual Studio with administrator rights

Upvotes: 2

Usman Farooq
Usman Farooq

Reputation: 1098

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

Upvotes: 12

Bassel
Bassel

Reputation: 193

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

enter image description here

Upvotes: 1

Flo Bayer
Flo Bayer

Reputation: 1250

Another soludtion could be renaming your remote repository to origin:

https://learn.microsoft.com/en-us/azure/devops/repos/git/creatingrepo?view=vsts&tabs=visual-studio#connect-a-local-repo-to-a-remote

Upvotes: 4

John Papa
John Papa

Reputation: 22298

git branch --set-upstream-to origin/my_branch

Or

git branch -u origin/my_branch

Upvotes: 15

Clever Neologism
Clever Neologism

Reputation: 1332

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.

Upvotes: 0

Related Questions