Over a million developers have joined DZone.

Integrating GitHub Enterprise With SSH and Tokens

DZone's Guide to

Integrating GitHub Enterprise With SSH and Tokens

Working on a project? Here is a quick way to integrate GitHub Enterprise to it via SSH and tokens.

Free Resource

Modernize your application architectures with microservices and APIs with best practices from this free virtual summit series. Brought to you in partnership with CA Technologies.

Quick Start Guide

Log into GitHub.yourOrganisation.com enterprise and request getting access to the organization.

Fork the GitHub yourOrganisation-API Repository to your GitHub Account.


Checking for existing SSH keys Lists the files in your .SSH directory, if they exist.

$ ls -al ~/.ssh
ls: cannot access '/c/Users/akhilesh/.ssh': No such file or directory

Generating a new SSH key and adding it to the ssh-agent


$ ssh-keygen -t rsa -b 4096 -C "akhilesh@yourOrganisation.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/akhilesh/.ssh/id_rsa):
Created directory '/c/Users/akhilesh/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/akhilesh/.ssh/id_rsa.
Your public key has been saved in /c/Users/akhilesh/.ssh/id_rsa.pub.

The key fingerprint is:

SHA256:GENERATED RSA XXXXXXXXX20@yourOrganisation.com
The key's randomart image is:
+---[RSA 4096]----+
| .   ==          |
|. o +.+.         |
|.o * * +.        |
| .+ + *.o..      |
|.+   . oSo .     |
|+ O    B..o      |
|.B =  =.+.       |
|. + .+o.E        |
|   oo..o         |

Adding your SSH key to the SSH-agent:

$ eval "$(ssh-agent -s)"

Agent pid 10140

To add a new SSH key to your GitHub account, copy the SSH key to your clipboard.

$ clip < ~/.ssh/id_rsa.pub

Go to: https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/  and follow the steps to add SSH to your GitHub account.

Creating an access token

Go to https://GitHub.yourOrganisation.com/settings/tokens. Follow the step given at: https://help.GitHub.com/articles/creating-an-access-token-for-command-line-use/ That token now effectively becomes your password when asked.

Clone GitHub source code

akhilesh@AKHILESHPC MINGW64 /d/yourproject-api09Jun
$ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
# exp : git clone https://GitHub.yourOrganisation.com/akhilesh/yourproject-api.git
Cloning into 'yourproject-api'...
Username for 'https://GitHub.yourOrganisation.com': akhilesh
#Promt window for Password : PASTE YOUR TOKEN HERE
remote: Counting objects: 3824, done.
remote: Compressing objects: 100% (1889/1889), done.
remote: Total 3824 (delta 1899), reused 3824 (delta 1899), pack-reused 0
Receiving objects: 100% (3824/3824), 4.19 MiB | 193.00 KiB/s, done.
Resolving deltas: 100% (1899/1899), done.
Checking connectivity... done.
Checking out files: 100% (7164/7164), done.  

Checking out the specific branch

Clone creates the master branch. However, you will have to tell it the specific branch that you want to check out.

akhilesh@AKHILESHPC MINGW64 /d/yourproject-akhilesh
$ cd yourproject
akhilesh@AKHILESHPC MINGW64 /d/yourproject-akhilesh/your project (master)
$ git checkout sprint7
Branch sprint7 set up to track remote branch sprint7 from origin.
Switched to a new branch 'sprint7'
akhilesh@AKHILESHPC MINGW64 /d/yourproject-akhilesh/your project  (sprint7)


Pushing to a remote

Use git push to push commits made on your local branch to a remote repository.



Use git fetch to retrieve new work done by other people.

$ git fetch remotename


Merging combines your local changes with changes made by others.

$ git merge remotename/branchname


Git pull is a convenient shortcut for completing both git fetch and git merge in the same command:

$ git pull remotename branchname

For more details go to https://help.github.com/

The Integration Zone is proudly sponsored by CA Technologies. Learn from expert microservices and API presentations at the Modernizing Application Architectures Virtual Summit Series.

github enterprise

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}