我经常想要做到这一点,但永远不会记得如何。GIT:同步本地文件到新的github版本库
首先我在我的电脑上创建一个文件,一些源代码,现在我想把它推到github仓库。
所以我创建了一个github回购。 (在github上)点击“克隆”以获取更高版本的URL。
现在我在本地机器上运行以下命令。
git init // make a repo, local
git add * // add files to repo
git commit -a -m "initial commit" // commit files to repo and add msg
git remote add origin (...url...) // tell git where to push
git push --set-upstream origin master // no idea what this does
git config --global user.name "...name..." // set my name so github knows what my username is
git push // does not work error:
To push the current branch and set the remote as upstream, use
git push --set-upstream origin master
还是不能“推”。我究竟做错了什么?
可能重复[默认行为的“git推”没有指定分支](https://stackoverflow.com/questions/) 948354/default-behavior-of-git-push-without-a-branch-specified) – phd
您的问题中的代码块是否是您实际运行的命令的日志?因为如果你在运行'git remote add origin'命令后运行'git push --set-upstream origin master',它应该适合你。 –
instantepiphany