所以问题是,我有一个git存储库,我想将它上传到GitHub。我在SOF上运行了多个线程,它建议使用git push -u origin master。问题是,当我这样做时它告诉我我需要先合并,所以我不会丢失任何数据。所以它建议给我git pull。我做了,这就是我得到的:
You asked me to pull without telling me which branch you
want to merge with, and 'branch.master.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.
If you often merge with the same branch, you may want to
use something like the following in your configuration file:
[branch "master"]
remote = <nickname>
merge = <remote-ref>
[remote "<nickname>"]
url = <url>
fetch = <refspec>
See git-config(1) for details.
我该如何解决这个问题?
编辑:没关系,我只是解决了这个问题。如果你们遇到这样的问题: git pull答案 0 :(得分:6)
假设您的分支被称为master并且远程称为origin:
git pull origin master
如果尚未设置遥控器,则执行此操作的命令为:
git remote add origin git@github.com:username/repository.git
两种情况下的原点只是github远程的通用名称。使用您的存储库名称替换用户名和存储库的用户名。之后,您将能够将您的github存储库称为“origin”。