Skip to content

Instantly share code, notes, and snippets.

@MtMath
Created May 4, 2023 14:02
Show Gist options
  • Save MtMath/b92b0be7045d30f3c3e0f969fa6bdd56 to your computer and use it in GitHub Desktop.
Save MtMath/b92b0be7045d30f3c3e0f969fa6bdd56 to your computer and use it in GitHub Desktop.
Git and Unity Private Packages

Unity Packages don`t access private repositories

Generating a new SSH key

  • Open Git Bash.
  • Paste the text below, substituting in your GitHub AE email address.
ssh-keygen -t rsa -b 4096 -C "[email protected]"

Adding your SSH key to the ssh-agent

  • Ensure the ssh-agent is running. You can use the "Auto-launching the ssh-agent"
# start the ssh-agent in the background
eval "$(ssh-agent -s)"
> Agent pid 59566
  • Add your SSH private key to the ssh-agent. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_rsa in the command with the name of your private key file.
ssh-add ~/.ssh/id_rsa
  • Add the SSH key to your account on GitHub. For more information
clip < ~/.ssh/id_rsa.pub

For Github:

git config --global --add url."[email protected]:".insteadOf "https://github.com/"

Enable GIT_TERMINAL_PROMPT

env GIT_TERMINAL_PROMPT=1

Now, verify the authentication with the below command.

ssh -T [email protected]

On successful authentication you will get the below output. > Hi your.user.name! You've successfully authenticated, but GitHub does not provide shell access.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment