[英]Pushing repo to remote repository (GitHub)
I'm new to Git/GitHub. 我是Git / GitHub的新手。 Trying to push my files to a new repo I have set up and it's not working.
尝试将文件推送到新的存储库中,但该文件无法正常工作。 Here's my process:
这是我的过程:
git remote add origiN <URL>
git remote -v
This seems to all go to plan, as Terminal returns 这一切似乎都按计划进行,随着航站楼的返回
origiN <URL> (fetch)
origiN <URL> (push)
...as expected. ...符合预期
Then, when I run git push
, I get: 然后,当我运行
git push
,我得到:
fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using
git remote add <name> <url>
and then push using the remote name
git push <name>
...but I thought I had already configured the remote repository? ...但是我以为我已经配置了远程存储库?
What am I missing? 我想念什么?
git push -u origin master
那你就可以git push
psydroyd answered whilst I was typing, but here is slightly more detail: 我输入时,psydroyd回答了,但这里有一些详细信息:
A repository can have multiple remotes. 一个存储库可以有多个远程服务器。 You can push to a remote explicitly by running:
您可以通过运行以下命令显式推送到远程服务器:
git push <remote> <branch>
But if you want git push
to work without any additional parameters, you can use the --set-upstream
option, aka -u
, as in: 但是,如果您想让
git push
在不使用任何其他参数的情况下工作,则可以使用--set-upstream
选项aka -u
,如下所示:
git push -u origin master
This sets up your local branch to track the remote master
branch. 这将设置您的本地分支以跟踪远程
master
分支。 After this point, you can run: 之后,您可以运行:
git push
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.