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 to origin/master was rejected.
What does that mean? Any ideas how I can do this simple push to a remote easily?
2 Solutions collect form web for “Webstorm Git new remote repository: Push to origin/master was rejected”
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://email@example.com:/some/path/my-project.git git push --all origin
To change the remote that’s not working, do
git remote remove origin git remote add origin ssh://...
Also, restart Webstorm/PHPstorm to invalidate cached settings, otherwise it wouldn’t work.