git Github 提交(推送)要点
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5299526/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Github committing (push) gist
提问by Sergey
I cannot understand this.
我不明白这。
I have created a gist. Then I run
我已经创建了一个要点。然后我跑
$ mkdir mygist $ cd mygist $ git init $ git pull [email protected]:869085.git
Then I add files, change files and try to commit.
然后我添加文件,更改文件并尝试提交。
$ git add . $ git commit -a -m "Better comments"
Then I do not know how to send it back to github and commit this git.
然后我不知道如何将其发送回github并提交此git。
回答by Mark Longair
It's probably easiest if you just start by cloning the gist, so that origin
(a "remote" that refers to the original repository) is set up for you. Then you can just do git push origin master
. For example:
如果您只是从克隆 gist 开始,这可能是最简单的,这样origin
(指原始存储库的“远程”)就会为您设置。然后你就可以了git push origin master
。例如:
git clone [email protected]:869085.git mygist
cd mygist
# Make your changes...
git add .
git commit -m "Better comments"
git push origin master
However, if you don't want to redo your changes, you can do:
但是,如果您不想重做更改,可以执行以下操作:
cd mygist
git remote add origin [email protected]:869085.git
git fetch origin
# Push your changes, also setting the upstream for master:
git push -u origin master
Strictly speaking, the git fetch origin
and -u
argument to git push origin master
are optional, but they will helpfully associate the upstream branch master
in origin
with your local branch master
.
严格来说,togit fetch origin
和-u
参数git push origin master
是可选的,但它们将有助于将上游分支master
inorigin
与您的本地分支相关联master
。
回答by igorw
Since you did not use git clone
you have no remote set up. While Mark Longair's solution is the best, an alternative would be:
由于您没有使用,因此git clone
您没有远程设置。虽然 Mark Longair 的解决方案是最好的,但替代方案是:
git push [email protected]:869085.git
回答by Artusamak
You just need to use the git push
command to send that to github.
您只需要使用该git push
命令将其发送到 github。