Add support for setting Gogs SSH key #1

Closed
opened 2017-12-04 11:53:56 +00:00 by benie · 2 comments
Owner

Currently setting GitHub SSH keys are supported, add
support for setting Gogs API keys on
code.infektor.net, and
GitLab.

Currently setting [GitHub](https:://github.com) SSH keys are supported, add support for setting Gogs API keys on [code.infektor.net](https://code.infektor.net), and [GitLab](https://docs.gitlab.com/ce/api/users.html#add-ssh-key-for-user).
Author
Owner

GitLab only documents authentication with Oauth2, personal access tokens, and
cookies. The following should allow users to set new SSH keys using basic
authentication. Note this is for v3 of the GitLab API which is deprecated in
favour of v4.

import getpass
import json
import sys
import requests

print sys.argv
username = sys.argv[1]
password = getpass.getpass('Password: ')
payload = {"login": username, "password": password}
r = requests.post("http://blah/api/v3/session", payload)

session = json.loads(r.text)
print session['private_token']
GitLab only documents authentication with Oauth2, personal access tokens, and cookies. The following _should_ allow users to set new SSH keys using basic authentication. Note this is for v3 of the GitLab API which is deprecated in favour of v4. ```python import getpass import json import sys import requests print sys.argv username = sys.argv[1] password = getpass.getpass('Password: ') payload = {"login": username, "password": password} r = requests.post("http://blah/api/v3/session", payload) session = json.loads(r.text) print session['private_token'] ```
Author
Owner

Added setting SSH keys for GitHub, GitLab, BitBucket Cloud, and Gogs, closing.

Added setting SSH keys for GitHub, GitLab, BitBucket Cloud, and Gogs, closing.
benie closed this issue 2018-01-04 18:43:12 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: config/bootstrap#1
No description provided.