Guest User

Untitled

a guest
Feb 2nd, 2018
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. git clone git@github.com:TheUser/TheProject.git -key "/home/christoffer/ssh_keys/theuser"
  2.  
  3. with_key("/home/christoffer/ssh_keys/theuser") do
  4. sh("git clone git@github.com:TheUser/TheProject.git")
  5. end
  6.  
  7. ssh-agent bash -c 'ssh-add /somewhere/yourkey; git clone git@github.com:user/project.git'
  8.  
  9. ssh-agent $(ssh-add /somewhere/yourkey; git clone git@github.com:user/project.git)
  10.  
  11. Host gitserv
  12. Hostname remote.server.com
  13. IdentityFile ~/.ssh/id_rsa.github
  14. IdentitiesOnly yes # see NOTES below
  15.  
  16. git remote add origin git@gitserv:myrepo.git
  17.  
  18. git push -v origin master
  19.  
  20. Host github.com
  21. IdentityFile ~/.ssh/github_rsa
  22.  
  23. GIT_SSH_COMMAND='ssh -i private_key_file' git clone host:repo.git
  24.  
  25. #!/bin/bash
  26.  
  27. ssh -i /path/to/ssh/secret/key $1 $2
  28.  
  29. GIT_SSH=my_git_ssh_wrapper git clone git@github.com:TheUser/TheProject.git
  30.  
  31. Host github.com
  32. HostName github.com
  33. IdentityFile /path/to/your/personal/github/private/key
  34. User dandv
  35.  
  36. Host github-work
  37. HostName github.com
  38. IdentityFile /path/to/your/work/github/private/key
  39. User workuser
  40.  
  41. core.sshCommand:
  42.  
  43. cd /path/to/my/repo
  44. git config core.sshCommand 'ssh -i private_key_file'
  45. # later on
  46. git clone host:repo.git
  47.  
  48. #!/bin/bash
  49. ssh -i ~/.ssh/gitkey_rsa "$@"
  50.  
  51. export GIT_SSH=~/gitwrap.sh
  52.  
  53. git config core.sshCommand "ssh -i ~/.ssh/id_rsa_example -F /dev/null"
  54. git pull
  55. git push
  56.  
  57. Host (a space separated list of made up aliases you want to use for the host)
  58. User git
  59. Hostname (ip or hostname of git server)
  60. PreferredAuthentications publickey
  61. IdentityFile ~/.ssh/id_rsa_(the key you want for this repo)
  62.  
  63. Host *
  64. User git
  65. Hostname github.com
  66. PreferredAuthentications publickey
  67. IdentityFile ~/.ssh/id_rsa_xxx
  68.  
  69. git -i ~/.ssh/thatuserkey.pem clone thatuser@myserver.com:/git/repo.git
  70.  
  71. git.sh -i ~/.ssh/thatuserkey.pem clone thatuser@myserver.com:/git/repo.git
  72.  
  73. #!/bin/bash
  74.  
  75. # The MIT License (MIT)
  76. # Copyright (c) 2013 Alvin Abad
  77. # https://alvinabad.wordpress.com/2013/03/23/how-to-specify-an-ssh-key-file-with-the-git-command
  78.  
  79. if [ $# -eq 0 ]; then
  80. echo "Git wrapper script that can specify an ssh-key file
  81. Usage:
  82. git.sh -i ssh-key-file git-command
  83. "
  84. exit 1
  85. fi
  86.  
  87. # remove temporary file on exit
  88. trap 'rm -f /tmp/.git_ssh.$$' 0
  89.  
  90. if [ "$1" = "-i" ]; then
  91. SSH_KEY=$2; shift; shift
  92. echo "ssh -i $SSH_KEY $@" > /tmp/.git_ssh.$$
  93. chmod +x /tmp/.git_ssh.$$
  94. export GIT_SSH=/tmp/.git_ssh.$$
  95. fi
  96.  
  97. # in case the git command is repeated
  98. [ "$1" = "git" ] && shift
  99.  
  100. # Run the git command
  101. git "$@"
  102.  
  103. bash -c 'eval `ssh-agent`; ssh-add /home/myname/.dotfiles/gitread; ssh-add -L; cd /home/myname/.dotfiles && git pull; kill $SSH_AGENT_PID'
  104.  
  105. Host gitlab.com
  106. RSAAuthentication yes
  107. IdentityFile ~/.ssh/your_private_key_name
  108. IdentitiesOnly yes
  109.  
  110. Host my_synology
  111. Hostname xxxx.synology.me
  112. IdentityFile ~/.ssh/id_rsa_xxxx
  113. User myname
  114. Port xx
  115.  
  116. git clone my_synology:path/to/repo.git
Add Comment
Please, Sign In to add comment