Generating Your SSH Public Key Many Git servers authenticate using SSH public keys. In order to provide a public key, each user in your system must generate one if they don’t already have one. Jul 14, 2019 In the user settings sidebar, click SSH and GPG keys. Then click New SSH key. Fill in the Title field with a descriptive label for the new key (for example, the name of your computer) and paste your public key into the Key field. Finally, click Add SSH key. The.pub file is your public key, and the other file is your private key. If you don’t have these files (or you don’t even have a.ssh directory), you can create them by running a program called ssh-keygen, which is provided with the SSH package on Linux/Mac systems and comes with Git for Windows.
Notes on using Git and GitHub. Just the essentials.
https://github.disney.com
or
https://github.com (generic)
Click Sign up or Sign inEnter your Username or Email & password
From the home page:
Click an existing repository, orClick the green box: + New repository
Add the repository name
Click and edit the README file
Other GitHub features are mostly click-able - navigate and explore as desired.
Install Git for Windows:https://git-scm.com
Accept all the defaults; add the Git Bash icon to your desktop / taskbar
The Git Bash shortcut properties are:
James@DESKTOP-6N4UAR1 MINGW64 ~/<path to your current directory>
$
Common Git CommandsThe Git shell is like a ssh environment:
pwd
- shows you the present working directory
cd /c/Dropbox/
- change to C:Dropbox directory
ls -al
- list all files in the current directory
git remote -v
- show the 'handles' for your remote connections - v = verbose
git help git
- dipslay the help index
git help <command>
- display help for specific commands
git help git
- opens an online man page on git
First time setupThe first time you use the git command shell, run these commands to save these to the environment so you don't have to do it again:
Note: If this is your first time using Git, you may need to set up authentication:Configuring Git Authentication
This is the process of 'forking' (getting a copy of) an existing repository from GitHub.com to a local PC directory. After you have a local copy on your PC, you can edit/add/delete files and then 'push' them back to the repository on GitHub.
Start the Git Bash shell
Create and/or change directory to where you'd like to create a copy of the repository on GitHubNote! The git clone command will create a new directory inside this folder with the same name as the repository on GitHub - so don't create and CD to the directory you anticipate the files to reside in.
Open a new browser window pointed to the GitHub repository:
Feb 26, 2018 From a Private Key we can generate a Public Key The Public Key is an ( x,y) co-ordinate on an Elliptic Curve The Public Key would be any point on this curve.
A generic GitHub login:
https://github.com
or the Disney Enterprise Monitoring repository:
https://github.disney.com/WDPR-EnterpriseMonitoring
or if you want to use a personal GitHub account (substitute your LANID):
https://github.disney.com/BAXTJ018/
Click to navigate to the repository you want to 'fork' (download a copy of)
Click the Green 'Clone or download' button and copy the URL to your clipboard - for example:
(this is the repository structure on GitHub)
Paste this entire git clone https://..
command into the Git shell on your PC.
If you have the proper authentication set up, you should see messages that indicate a copy of the repository is being created on your PC.
ls -al
- the new repository directory should show up
Change directory to the new repository directory cd /<new folder>
ls -al
- you should see .git and a README.md and other repository files
After you have edited / added / deleted files in your local PC directory, you can update the files in the GitHub repository.
Get the local Git status:git status
- creates a list of files that have been modified/added/deleted
Indicate that you want Git to track all the files in your local directory:git add .
You could also indicate specific files only: git add <filename>
Commit everything that has been 'staged' and add a message (mandatory):git commit -m 'latest updates'
Push the file updates to the GitHub repository:git push origin master
You may be prompted for your username and password
You will have to add a ssh key to git hub - follow the instructions on the link below:https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/
Generating a new SSH key and adding it to the ssh-agent
MAC WINDOWS LINUX
After you've checked for existing SSH keys, you can generate a new SSH key to use for authentication, then add it to the ssh-agent.
If you don't already have an SSH key, you must generate a new SSH key. If you're unsure whether you already have an SSH key, check for existing keys.
If you don't want to reenter your passphrase every time you use your SSH key, you can add your key to the SSH agent, which manages your SSH keys and remembers your passphrase.
Generating a new SSH key
Open Git Bash.
Paste the text below, substituting in your GitHub email address.
ssh-keygen -t rsa -b 4096 -C 'your_email@example.com'
This creates a new ssh key, using the provided email as a label.
Generating public/private rsa key pair
When you're prompted to 'Enter a file in which to save the key,' press Enter. This accepts the default file location.
Enter a file in which to save the key (/c/Users/you/.ssh/id_rsa):[Press enter]
At the prompt, type a secure passphrase. For more information, see 'Working with SSH key passphrases'.
Enter passphrase (empty for no passphrase): [Type a passphrase]Enter same passphrase again: [Type passphrase again]
Adding your SSH key to the ssh-agent
Before adding a new SSH key to the ssh-agent to manage your keys, you should have checked for existing SSH keys and generated a new SSH key.
If you have GitHub Desktop installed, you can use it to clone repositories and not deal with SSH keys. It also comes with the Git Bash tool, which is the preferred way of running git commands on Windows.
Ensure the ssh-agent is running:
If you are using the Git Shell that's installed with GitHub Desktop, the ssh-agent should be running.If you are using another terminal prompt, such as Git for Windows, you can use the 'Auto-launching the ssh-agent' instructions in 'Working with SSH key passphrases', or start it manually:
start the ssh-agent in the background
eval $(ssh-agent -s)
Agent pid 59566
Add your SSH key to the ssh-agent. If you are using an existing SSH key rather than generating a new SSH key, you'll need to replace id_rsa in the command with the name of your existing private key file.
$ ssh-add ~/.ssh/id_rsa
Next Step: Add the SSH key to your GitHub account
###Adding a new SSH key to your GitHub account
MAC WINDOWS LINUX
To configure your GitHub account to use your new (or existing) SSH key, you'll also need to add it to your GitHub account.
Before adding a new SSH key to your GitHub account, you should have:
Checked for existing SSH keysGenerated a new SSH key and added it to the ssh-agentNote: DSA keys were deprecated in OpenSSH 7.0. If your operating system uses OpenSSH, you'll need to use an alternate type of key when setting up SSH, such as an RSA key. For instance, if your operating system is MacOS Sierra, you can set up SSH using an RSA key.
Copy the SSH key to your clipboard.
If your SSH key file has a different name than the example code, modify the filename to match your current setup. When copying your key, don't add any newlines or whitespace.
$ clip < ~/.ssh/id_rsa.pub
Copies the contents of the id_rsa.pub file to your clipboard
Tip: If clip isn't working, you can locate the hidden .ssh folder, open the file in your favorite text editor, and copy it to your clipboard.
Settings icon in the user bar in the upper-right corner of any page, click your profile photo, then click Settings.
Authentication keysIn the user settings sidebar, click SSH and GPG keys.
SSH Key buttonClick New SSH key or Add SSH key.
In the 'Title' field, add a descriptive label for the new key. For example, if you're using a personal Mac, you might call this key 'Personal MacBook Air'.The key fieldPaste your key into the 'Key' field.The Add key buttonClick Add SSH key.
Sudo mode dialog
If prompted, confirm your GitHub password.
$ git clone git@github.disney.com:BAXTJ018/SplunkOnAWS.git
is not the same repository as
$ git clone git@github.disney.com:WDPR-EnterpriseMonitoring/SplunkOnAWS.git
Getting it to work
Written with StackEdit.