Skip to content

Commit 524743f

Browse files
GitHubSSHKey v0.4.0
1 parent 38d5bc6 commit 524743f

File tree

16 files changed

+613
-2
lines changed

16 files changed

+613
-2
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,4 @@ cython_debug/
157157
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158158
# and can be added to the global gitignore or merged into this file. For a more nuclear
159159
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160-
#.idea/
160+
.idea/

MANIFEST.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
include LICENSE
2+
include README.md
3+
include requirements.txt
4+
include tox.ini
5+
include setup.cfg
6+
include setup.py
7+
global-exclude tests/*
8+
global-exclude data/*
9+
global-exclude requirements/*

README.md

Lines changed: 166 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,167 @@
11
# github-ssh-key
2-
github-ssh-key
2+
___github-ssh-key___ - GitHub ssh key manager. Console utility for creating, getting, testing,
3+
using public ssh keys for GitHub.
4+
***
5+
6+
![GitHub top language](https://img.shields.io/github/languages/top/smartlegionlab/github-ssh-key)
7+
[![PyPI - Downloads](https://img.shields.io/pypi/dm/github-ssh-key?label=pypi%20downloads)](https://pypi.org/project/github-ssh-key/)
8+
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/smartlegionlab/github-ssh-key)](https://github.com/smartlegionlab/github-ssh-key/)
9+
[![GitHub](https://img.shields.io/github/license/smartlegionlab/github-ssh-key)](https://github.com/smartlegionlab/github-ssh-key/blob/master/LICENSE)
10+
[![PyPI](https://img.shields.io/pypi/v/github-ssh-key)](https://pypi.org/project/github-ssh-key)
11+
[![PyPI - Format](https://img.shields.io/pypi/format/github-ssh-key)](https://pypi.org/project/github-ssh-key)
12+
[![GitHub Repo stars](https://img.shields.io/github/stars/smartlegionlab/github-ssh-key?style=social)](https://github.com/smartlegionlab/github-ssh-key/)
13+
[![GitHub watchers](https://img.shields.io/github/watchers/smartlegionlab/github-ssh-key?style=social)](https://github.com/smartlegionlab/github-ssh-key/)
14+
[![GitHub forks](https://img.shields.io/github/forks/smartlegionlab/github-ssh-key?style=social)](https://github.com/smartlegionlab/github-ssh-key/)
15+
16+
***
17+
18+
Author and developer: ___A.A Suvorov___
19+
20+
***
21+
22+
## Supported:
23+
24+
- Linux: All.
25+
- Termux (Android).
26+
27+
***
28+
29+
## Images:
30+
31+
![logo](https://github.com/smartlegionlab/github-ssh-key/raw/master/data/images/github-ssh-key.png)
32+
33+
***
34+
35+
## What's new?
36+
37+
### ___github-ssh-key v0.3.0___
38+
39+
- Improved work with help, added the ability to run commands directly from help.
40+
- Improved interface.
41+
42+
***
43+
44+
## Description:
45+
46+
___github-ssh-key___ - GitHub ssh key manager. Console utility for creating, getting,
47+
testing, using public ssh keys for GitHub.
48+
49+
Possibilities:
50+
51+
- Convenient interactive menu.
52+
- Generating ssh keys for GitHub.
53+
- Output ssh key to the console.
54+
- Adding ssh key to GitHub.
55+
- Checking the ssh key, testing the connection.
56+
- Interactive menu for working with the utility.
57+
- Interactive menu for help.
58+
- Launch the default browser with a page for adding ssh key on GitHub.
59+
- Cloning private repositories via ssh.
60+
- Running individual commands.
61+
62+
***
63+
64+
## Help:
65+
66+
### Install and use:
67+
68+
#### Install:
69+
70+
`pip install github-ssh-key`
71+
72+
`github-ssh-key`
73+
74+
#### Use:
75+
76+
To access GitHub over ssh, you should run some sequence of actions.
77+
78+
- Install openssh;
79+
- Generate new ssh keys;
80+
- Copy the public key;
81+
- Add your public key to GitHub;
82+
- Check the connection;
83+
84+
This utility provides you with these capabilities.
85+
86+
Adding a key to your GitHub account involves several steps:
87+
88+
1. Generating new ssh key.
89+
- Install openssh, or make sure you have it installed with the ssh command.
90+
- During the generation process, enter your email that you use when working with GitHub.
91+
- Do not change the default file name.
92+
- Don't set a passphrase if you don't want to enter it every time.
93+
2. Copying ssh key.
94+
- Highlight and completely copy your ssh key.
95+
3. Adding ssh key to your GitHub account.
96+
- Highlight and completely copy your ssh key.
97+
- Add your ssh key to your GitHub account.
98+
4. Testing the ssh key (Testing the connection).
99+
- For a successful connection, you had to follow these steps:
100+
- Generate ssh key.
101+
- Highlight and completely copy your ssh key.
102+
- Add ssh key to your GitHub account.
103+
- If you did everything correctly, you will see a personalized greeting.
104+
105+
Also, directly from the interactive menu, you can clone your private
106+
repository using ssh.
107+
108+
To get help with commands, use:
109+
110+
`github-ssh-key [command] -h`
111+
112+
`github-ssh-key new -h`
113+
`github-ssh-key show -h`
114+
`github-ssh-key add -h`
115+
`github-ssh-key test -h`
116+
`github-ssh-key clone -h`
117+
`github-ssh-key help -h`
118+
119+
#### Commands:
120+
121+
`github-ssh-key [command] [args]`
122+
123+
- run `github-ssh-key run`
124+
- new `github-ssh-key new -e [your email]`
125+
- show `github-ssh-key show`
126+
- add `github-ssh-key add`
127+
- test `github-ssh-key test`
128+
- clone `github-ssh-key clone -l [GitHub login] -n [repo name]`
129+
130+
131+
#### Variant 1:
132+
133+
- Go to the project folder
134+
- `python setup.py install`
135+
- `github-ssh-key`
136+
137+
#### Variant 2:
138+
139+
- Install [python](https://python.org)
140+
- Go to the project folder
141+
- `pip install -r requirements.txt`
142+
- `python github-ssh-key.py`
143+
144+
***
145+
146+
## Disclaimer of liability:
147+
148+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
149+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
150+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
151+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
152+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
153+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
154+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
155+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
156+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
157+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
158+
159+
***
160+
161+
## Copyright:
162+
--------------------------------------------------------
163+
Licensed under the terms of the BSD 3-Clause License
164+
(see LICENSE for details).
165+
Copyright © 2018-2024, A.A Suvorov
166+
All rights reserved.
167+
--------------------------------------------------------

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
theme: jekyll-theme-architect

data/images/github-ssh-key.png

26.6 KB
Loading

github-ssh-key.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# --------------------------------------------------------
2+
# Licensed under the terms of the BSD 3-Clause License
3+
# (see LICENSE for details).
4+
# Copyright © 2018-2024, A.A Suvorov
5+
# All rights reserved.
6+
# --------------------------------------------------------
7+
# https://github.com/smartlegionlab
8+
# --------------------------------------------------------
9+
from github_ssh_key.app import cli
10+
11+
if __name__ == '__main__':
12+
cli()

github_ssh_key/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# --------------------------------------------------------
2+
# Licensed under the terms of the BSD 3-Clause License
3+
# (see LICENSE for details).
4+
# Copyright © 2018-2024, A.A Suvorov
5+
# All rights reserved.
6+
# --------------------------------------------------------
7+
# https://github.com/smartlegionlab
8+
# --------------------------------------------------------
9+
"""GitHub ssh key manager."""
10+
__version__ = '0.4.0'

github_ssh_key/app.py

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# --------------------------------------------------------
2+
# Licensed under the terms of the BSD 3-Clause License
3+
# (see LICENSE for details).
4+
# Copyright © 2018-2024, A.A Suvorov
5+
# All rights reserved.
6+
# --------------------------------------------------------
7+
# https://github.com/smartlegionlab
8+
# --------------------------------------------------------
9+
import click
10+
11+
from github_ssh_key.manager import CliManager
12+
13+
14+
@click.group(
15+
invoke_without_command=True,
16+
context_settings={'help_option_names': ['-h', '--help']},
17+
)
18+
@click.version_option(f'{CliManager.name} v{CliManager.version}')
19+
@click.pass_context
20+
def cli(ctx):
21+
"""
22+
GitHub ssh key manager.
23+
24+
Copyright © 2018-2024, A.A Suvorov; All rights reserved.
25+
26+
https://github.com/smartlegionlab/
27+
28+
"""
29+
CliManager.show_head()
30+
if ctx.invoked_subcommand is None:
31+
CliManager.commander.run()
32+
33+
34+
@cli.command(name='run')
35+
def run():
36+
"""Run Main menu."""
37+
CliManager.commander.run()
38+
39+
40+
@cli.command(name='new')
41+
@click.option('-e', 'email', type=click.STRING, default=None, help='Your email used on GitHub')
42+
def new_key(email):
43+
"""Create new public ssh keys."""
44+
CliManager.commander.new_key(email=email)
45+
46+
47+
@cli.command(name='test')
48+
def test_key():
49+
"""Test your public ssh keys."""
50+
CliManager.commander.test_key()
51+
52+
53+
@cli.command(name='show')
54+
def show_key():
55+
"""Show your public ssh keys."""
56+
CliManager.commander.show_key()
57+
58+
59+
@cli.command(name='clone')
60+
@click.option('-l', '--login', type=click.STRING, help='GitHub login', default=None)
61+
@click.option('-n', '--name', type=click.STRING, help='Repo name', default=None)
62+
def clone_repo(login, name):
63+
"""Clone your GitHub repository using ssh."""
64+
CliManager.commander.clone_repo(login=login, repo_name=name)
65+
66+
67+
@cli.command(name='add')
68+
def add_key():
69+
"""Open https://github.com/settings/keys in default browser"""
70+
CliManager.commander.add_key()
71+
72+
73+
@cli.result_callback()
74+
def process_result(result):
75+
"""Process result"""
76+
CliManager.show_footer()
77+
78+
79+
if __name__ == '__main__':
80+
cli()

0 commit comments

Comments
 (0)