正在将 GitHub 连接到闪亮服务器

Connecting GitHub to Shiny Server

我正在尝试使用 manual of Dean Attali 设置一个闪亮的服务器。到目前为止,我使闪亮的服务器正常工作。当我导航到服务器 ip 时,“欢迎使用闪亮的服务器”页面会显示这一事实,这应该可以证明这一点。问题是我无法像手册的第 8.2 步那样将闪亮的服务器连接到 GitHub。我现在尝试了几次,但收到此错误消息:

error: src refspec master does not match any.

error: failed to push some refs to 'origin'

这是我的代码:

sudo apt-get -y install git
cd /srv/shiny-server
git init
echo "# shiny-server" >> README.md
git commit -m "first commit"
git config --global user.email "user@user.com"
git config --global user.name "gituser"
git remote add origin git@github.com:gituser/shiny-server.git

电子邮件地址“user@user.com”和用户名“gituser”只是假人。

我已经在 GitHub 的存储库设置中部署了合适的密钥。

希望你能帮助我!提前致谢:)

这里少了一步:

git init
echo "# shiny-server" >> README.md
git commit -m "first commit"

缺少的步骤是 git add,将 README.md 添加到 Git。

如果没有 git add 步骤,git commit 什么也不会做。因此,存储库没有任何提交,因此没有什么可推送的, 导致您观察到的错误。

这样就可以了:

git init
echo "# shiny-server" >> README.md
git add --all
git commit -m "first commit"