Github gist edición sin cambiar la URL
Tengo un gist con algún código javascript en una etiqueta script
, así:
<script src="https://raw.github.com/gist/b25dff23c2c4b4bd425a/f157aa95163311c4b58febb06b49ffd16419f642/images.js"></script>
Y necesitaré seguir editando el archivo JS en github. Sin embargo, cuando editas un gist, cambia la URL del gist. ¿Cómo mantengo la misma URL?
6 answers
Gist cambió la ruta a este patrón de archivo:
https://gist.github.com/<USER_NAME>/<GIST_ID>/raw/<GIST_REVISION_ID>/<GIST_FILE_NAME>
Te darás cuenta de que ahora los enlaces de las respuestas principales son 404' ing.
Simplemente aplicar este nuevo patrón y voilà!
https://gist.github.com/<USER_NAME>/<GIST_ID>/raw/<GIST_FILE_NAME>
Por ejemplo:
Https://gist.githubusercontent.com/wesbos/cd16b8b1815825f111a2/raw/lol.js
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-07-11 15:50:33
En caso de gist,https://raw.github.com/gist/[gist_id]
Ohttps://gist.github.com/[user_name]/[gist_id]/raw
(que es más probable que sea un URI único.)
devuelve el primer archivo del gist.
Para gist con varios archivos, https://raw.github.com/gist/[gist_id] / [file_name]
La url funciona incluso cuando se cambia el nombre del archivo.
Por ejemplo https://raw.github.com/gist/4636655 https://raw.github.com/gist/4636655/imdb-getglue.js
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-09-09 02:29:11
Simplemente agrega /raw
al final de tu url de gist.
https://gist.github.com/--user--/--id--/raw
Esto enlaza con la última revisión de ese archivo.
Después de actualizar el archivo gist, los cambios se reflejan después de un minuto o dos.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-06-23 16:59:18
No puedes cambiar el contenido sin enviarlo (guardarlo) y eso te da una nueva URL.
Si quieres un enlace a algo estarás cambiando constantemente y la URL siempre será la misma, ponlo en un repositorio y guarda los cambios confirmándolo.
Terminarás con algo como:
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-09-20 23:53:44
Los otros métodos no funcionaron, así que estoy usando rawgit.com
:
https://rawgit.com/<user>/<id>/raw/<file>
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-07-31 11:51:12
También es posible eliminar su nombre de usuario de la url, si lo desea.
Tome la url de la respuesta aceptada arriba:
https://gist.github.com/<USER_NAME>/<GIST_ID>/raw/<GIST_FILE_NAME>
Remove <USER_NAME>
and move raw
in front of <GIST_ID>
, where the username was:
https://gist.github.com/raw/<GIST_ID>/<GIST_FILE_NAME>
Pero no funciona con RawGit.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-01-30 11:58:06