GIT首次推出新项目

ste*_*tef 8 git version-control repository git-push

我在我的本地机器上有一个项目,我一直在单独工作,我想推送到远程服务器(运行ubuntu和gitosis)

在我做的远程服务器上

git init
Initialized empty Git repository in /home/stefan/.git/
Run Code Online (Sandbox Code Playgroud)

当地人git status

git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   .DS_Store
#   .travis.yml
#   license.txt
#   nbproject/
#   bla/.DS_Store
#   bla/cache/
nothing added to commit but untracked files present (use "git add" to track)
Run Code Online (Sandbox Code Playgroud)

我也做了

git remote add origin dev@123.456.xx.xxx:psdemo.git
Run Code Online (Sandbox Code Playgroud)

现在:当我尝试推动时,会发生以下情况

git push origin master
fatal: 'psdemo.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
Run Code Online (Sandbox Code Playgroud)

这是有道理的,因为我只有一个空的git repo.

如何将文件推送到此远程服务器?我猜我需要的是从我的本地机器克隆到远程机器,不知何故?

Ald*_*nio 7

字符串

dev@123.456.xx.xxx:psdemo.git
Run Code Online (Sandbox Code Playgroud)

应该是一个有效的ssh路径.据我在上一行中看到:

git init
Initialized empty Git repository in /home/stefan/.git/
Run Code Online (Sandbox Code Playgroud)

你在/ home/stefan /中创建了一个存储库,所以我希望有类似的东西:

stefan@123.456.xx.xxx:~
Run Code Online (Sandbox Code Playgroud)

但可能不是你想要的.您应该psdemo.git在家中的远程服务器中创建一个文件夹.为此,做一个

git init --bare ~/psdemo.git
Run Code Online (Sandbox Code Playgroud)

在那,然后添加遥控器:

 stefan@123.456.xx.xxx:~/psdemo.git
Run Code Online (Sandbox Code Playgroud)

那么你应该能够推!