How to push local repository to remote in Visual Studio?

Viewed 2504

I have a project in visual studio. I want to create remote repository for it and push it there. Is it possible to do all of that in visual studio or is my only option to use git in command line, follow the answer of How do I move my local Git repository to a remote Git repository and clone my remote repo in IDE?

I have added local repository to the project in Visual Studio and created remote repository. However when i try to push local to remote I receive the following outgoing commits message: The current branch does not track a remote branch. Push your changes to a new branch on the origin remote and set the upstream branch.

1 Answers

You need to create a repository manually on the remote server. Usually you can do that using a web interface (like GitHub, BitBucket, etc). Once you have your repository created, you need an initial commit. For this part, you have 2 options:

  1. Create the initial commit using that same web interface and then clone the repository to your local machine and you're done: https://confluence.atlassian.com/bitbucketserver067/clone-a-repository-979426617.html

  2. Initialize the new repository on your local machine, in the project folder, push it to the remote repository and you're done: https://confluence.atlassian.com/bitbucketserver/importing-code-from-an-existing-project-776640909.html

Doing this from Visual Studio is possible through the Team Explorer tool window. First, use Manage Connections to create/initialize/clone the repository locally and then use Changes and Sync buttons to update your commits and push/pull changes to the remote repository.

Related