Init gist with regular urls via git CLI (http) (#501)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Init Gists via Git
|
||||
|
||||
Opengist allows you to create new snippets via Git over HTTP.
|
||||
Opengist allows you to create new snippets via Git over HTTP. You can create gists with either auto-generated URLs or custom URLs of your choice.
|
||||
|
||||
Simply init a new Git repository where your file(s) is/are located:
|
||||
|
||||
@@ -10,19 +10,41 @@ git add .
|
||||
git commit -m "My cool snippet"
|
||||
```
|
||||
|
||||
Then add this Opengist special remote URL and push your changes:
|
||||
### Option A: Regular URL
|
||||
|
||||
Create a gist with a custom URL using the format `http://opengist.url/username/custom-url`, where `username` is your authenticated username and `custom-url` is your desired gist identifier.
|
||||
|
||||
The gist must not exist yet if you want to create it, otherwise you will just push to the existing gist.
|
||||
|
||||
```shell
|
||||
git remote add origin http://localhost:6157/init
|
||||
git remote add origin http://opengist.url/thomas/my-custom-gist
|
||||
|
||||
git push -u origin master
|
||||
```
|
||||
|
||||
Log in with your Opengist account credentials, and your snippet will be created at the specified URL:
|
||||
**Requirements for custom URLs:**
|
||||
- The username must match your authenticated username
|
||||
- URL format: `http://opengist.url/username/custom-url`
|
||||
- The custom URL becomes your gist's identifier and title
|
||||
- `.git` suffix is automatically removed if present
|
||||
|
||||
### Option B: Init endpoint
|
||||
|
||||
Use the special `http://opengist.url/init` endpoint to create a gist with an automatically generated URL:
|
||||
|
||||
```shell
|
||||
Username for 'http://localhost:6157': thomas
|
||||
Password for 'http://thomas@localhost:6157':
|
||||
git remote add origin http://opengist.url/init
|
||||
|
||||
git push -u origin master
|
||||
```
|
||||
|
||||
## Authentication
|
||||
|
||||
When you push, you'll be prompted to authenticate:
|
||||
|
||||
```shell
|
||||
Username for 'http://opengist.url': thomas
|
||||
Password for 'http://thomas@opengist.url': [your-password]
|
||||
Enumerating objects: 3, done.
|
||||
Counting objects: 100% (3/3), done.
|
||||
Delta compression using up to 8 threads
|
||||
@@ -30,12 +52,12 @@ Compressing objects: 100% (2/2), done.
|
||||
Writing objects: 100% (3/3), 416 bytes | 416.00 KiB/s, done.
|
||||
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
|
||||
remote:
|
||||
remote: Your new repository has been created here: http://localhost:6157/thomas/6051e930f140429f9a2f3bb1fa101066
|
||||
remote: Your new repository has been created here: http://opengist.url/thomas/6051e930f140429f9a2f3bb1fa101066
|
||||
remote:
|
||||
remote: If you want to keep working with your gist, you could set the remote URL via:
|
||||
remote: git remote set-url origin http://localhost:6157/thomas/6051e930f140429f9a2f3bb1fa101066
|
||||
remote: git remote set-url origin http://opengist.url/thomas/6051e930f140429f9a2f3bb1fa101066
|
||||
remote:
|
||||
To http://localhost:6157/init
|
||||
To http://opengist.url/init
|
||||
* [new branch] master -> master
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user