简体   繁体   中英

git push master to server with ssh

I'm new to git and I want to push a node.js project from ide.goorm.io to a apache server with git and with ssh-authentification. (This is given from my server.) In goorm I was able to add my private key to the ssh-agent. I initialized a git repo, added files and commited them all.

With this line I try to push my project to my server:

git push ssh://user@IP/folder/repo.git/ master

In repo.git is a git init --bare repository. (or just a git init. I tried both.)

I get this error:

fatal: '/folder/repo.git/' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

How can I initialize a new repo on the server? Does it have to be a git init or a git init --bare? Does the git repo on the server need to have the same folder names or git repo names?

Does it have to be a git init or a git init --bare?

Bare. See the difference .

Does the git repo on the server need to have the same folder names or git repo names?

No, any name will do.

ssh user@IP "
cd /folder
git init --bare repo.git"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM