在服务器上正确创建git仓库

时间:2019-05-08 16:29:54

标签: git

我登录到服务器并使用以下命令创建了一个仓库:

mkdir project.git
cd project.git
git init --bare

然后在我的本地计算机上执行:

git clone server@server:/path/to/repos/project

似乎有效。但是,如果我导航到该文件夹​​,则会在pull上收到如下错误:

git pull
Your configuration specifies to merge with the ref 'refs/heads/master'
from the remote, but no such ref was fetched.

git status
On branch master
Your branch is based on 'origin/master', but the upstream is gone.
  (use "git branch --unset-upstream" to fixup)

nothing to commit, working tree clean

touch test.txt
git commit -am "test file"
On branch master
Your branch is based on 'origin/master', but the upstream is gone.
  (use "git branch --unset-upstream" to fixup)

Untracked files:
    test.txt

nothing added to commit but untracked files present

1 个答案:

答案 0 :(得分:1)

裸仓库中实际上没有任何东西...因此没有master分支....如果拉,那么就没有master分支....这就是为什么会出错。在本地上写一些东西,提交并推送给主服务器,然后您将在远程上放一些东西。