开发者

Github committing (push) gist

I cannot understand this.

I have created a gist. Then I run

$ mkdir mygist
$ cd mygist
$ git init
$ git pull git@gist.github.com:869085.git

Then I add files, change files and try to commit.

$ gi开发者_C百科t add .
$ git commit -a -m "Better comments"

Then I do not know how to send it back to github and commit this git.


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:

git clone git@gist.github.com: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 git@gist.github.com: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.


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 push git@gist.github.com:869085.git


You just need to use the git push command to send that to github.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜