simple simple - 19 days ago 11
Git Question

Webstorm Git new remote repository: Push to origin/master was rejected

Simple question: In webstorm, how do I push my local directory to a remote server to make a new remote repository?

I created a local repository using webstorm as defined here: https://www.jetbrains.com/pycharm/help/setting-up-a-local-git-repository.html#createNewRepository

Now I have a local directory with a .git in that directory.

I copied that .git file and put it on my remote server and renamed it as myRemote.git

In webstorm I: git remote add origin z:\myRemote.git

Then in webstorm I add files and push using the webstorm dialogs.

I receive an error:
Push rejected
Push to origin/master was rejected.

What does that mean? Any ideas how I can do this simple push to a remote easily?

Answer

You set up a remote repository by doing the following:

On the remote server

cd /some/path
mkdir my-project.git
cd my-project.git
git init --bare

Then, on the local machine (assuming there's already a repo there)

cd /my/project/path
git remote add origin ssh://my-user@host.server:/some/path/my-project.git
git push --all origin
Comments