简体   繁体   中英

Git - how to push a new git-project on a server?

I'm actually trying to push my work on my personal git server.

I just made a git init test , added and commited a test file, and added a remote pointing to server with git remote add . I didn't create a git repository on my server, so my ssh://git@XXX.XXX.XXX.XXX:XXXX/opt/git/test.git remote does not already exist.

I have the does not appear to be a git repository error.

The user "git" is the owner of the /opt/git directory.

Isn't that possible to create the non-existing repository by pushing to it for the first time? I could do it with ssh but this isn't very pratical... Isn't there an other way? I found no option for that.

I thank you for your help and I apologize for my possible spelling mistakes (I'm french).

No, there is no way for a push to happen automatically, if the remote specified is not a git repo itself.

You will have to ssh into your server, and run a git init to create an empty git repository.

It seems to me that you are trying to host your repository on your server, if that is the case, I would suggest using a bare repository . Basically, when initializing the repo, use git init --bare .

Also, I would suggest that you go through the various protocols for setting up git server, you are using the git protocol which requires additional steps as mentioned in the link, and that should save you some effort debugging the setup.

根据错误的说法,你似乎应该在推送它之前在远程服务器目录中执行git init

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