How to clone/edit/push a GitHub Gist


We can’t add any collaborators to a GitHub Gist.

clone

We can clone a gist with HTTPS clone URL with a username provided.

$ git clone https://<username>@gist.github.com/<id>.git
Cloning into '<id>'...
remote: Counting objects: ..., done.
remote: Compressing objects: 100% (.../...), done.
remote: Total ... (delta ...), reused ... (delta ...), pack-reused ...
Unpacking objects: 100% (.../...), done.
Checking connectivity... done.
$ cd <id>
$ git remote show origin
* remote origin
  Fetch URL: https://<username>@gist.github.com/<id>.git
  Push  URL: https://<username>@gist.github.com/<id>.git
  HEAD branch: master
  Remote branch:
    master tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local ref configured for 'git push':
    master pushes to master (local out of date)
$

Now we can make changes to our files.

push

And git might ask for your password when we push commits back to the remote.

$ git push
Password for 'https://<username>@gist.github.com': <password>
Counting objects: ..., done.
Delta compression using up to ... threads.
Compressing objects: 100% (.../...), done.
Writing objects: 100% (.../...), ... bytes | ... bytes/s, done.
Total ... (delta ...), reused ... (delta ...)
To https://<username>@gist.github.com/<id>.git
   xxxxxxx..xxxxxxx  master -> master
$
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s