【发布时间】:2018-12-14 20:37:48
【问题描述】:
我是 git 的新手,想了解一下它。
因此,我正在本地开发一个简单的网站并使用 git 对其进行跟踪,并希望将面向公众的服务器上的远程存储库作为实时站点,只要我准备好,我就可以将主分支推送到该站点。
我认为以下方法会起作用,但事实并非如此。
公共服务器我这样做了:
/home/mysite/git init --bare
本地(开发机器)我是这样做的:
git init
git add index.html (contains hello world)
git commit -am "initial commit"
git remote add website ssh://mysiteuser@mysite:myport
git remote (outputs: website)
现在我想将它发布到“网站”
git push website
我得到:
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream website master
所以我试试:
git push --set-upstream 网站管理员
我得到:
fatal: No path specified. See 'man git-pull' for valid url syntax
我查看了 man git pull ,但它对我没有任何启示。
我这样做是对的,但在 push 命令中遗漏了一些东西吗?还是我误解了更基本的东西。
TIA!
【问题讨论】:
-
git push website -u master:refs/heads/master. -
你能分享一下.git/config文件的o/p吗?希望你坐在主分支上。 $ git push origin master 一般使用。
-
这是本地 git 配置文件内容(为保护隐私而编辑) [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true ignorecase = true precomposeunicode = true [remote "website"] url = ssh://website@myserver:myport/home/website/website.git fetch = +refs/heads/*:refs/remotes/website/* [branch "master"] remote = website merge = refs/heads/master
标签: git repository workflow git-push git-remote