Difference between revisions of "Git"
(→SSH) |
|||
Line 5: | Line 5: | ||
== Git User == |
== Git User == |
||
A Git user must be provided by the development organization. This Git user must have <b>clone, pull, and push</b> access to the projects' repositories to be on-boarded. This Git user is used for <b>all</b> projects. |
A Git user must be provided by the development organization. This Git user must have <b>clone, pull, and push</b> access to the projects' repositories to be on-boarded. This Git user is used for <b>all</b> projects. |
||
+ | |||
+ | Scripts started by the <code>jenkins</code> user clone and push to and from the repository; The Git user login and password must be set as per this page: |
||
+ | [https://confluence.atlassian.com/display/STASH/Permanently+authenticating+with+Git+repositories#PermanentlyauthenticatingwithGitrepositories-Usingcredentialcaching] |
||
== SSH == |
== SSH == |
||
One possibility is to have a user (jenkins on a CI) have an SSH key to be added to the GitHub account for that Linux user. For instance, log in as 'jenkins' on the CI system. Then generate an SSH is it does not already exist, and add the SSH key to the GitHub account. To do so, follow the instructions listed at https://help.github.com/articles/generating-an-ssh-key/ . |
One possibility is to have a user (jenkins on a CI) have an SSH key to be added to the GitHub account for that Linux user. For instance, log in as 'jenkins' on the CI system. Then generate an SSH is it does not already exist, and add the SSH key to the GitHub account. To do so, follow the instructions listed at https://help.github.com/articles/generating-an-ssh-key/ . |
||
+ | == .netrc == |
||
− | == Set Git Authentication for the Jenkins User == |
||
− | A possible alternative to |
+ | A possible alternative to the SSH key route is using .netrc. |
− | [https://confluence.atlassian.com/display/STASH/Permanently+authenticating+with+Git+repositories#PermanentlyauthenticatingwithGitrepositories-Usingcredentialcaching] |
||
The following is an example of a <code>~jenkins/.netrc</code> file on Unix: |
The following is an example of a <code>~jenkins/.netrc</code> file on Unix: |
Revision as of 21:13, 15 September 2016
Contents
Install Git
On the Unix box, install Git. To do so, follow this link: [1]
Git User
A Git user must be provided by the development organization. This Git user must have clone, pull, and push access to the projects' repositories to be on-boarded. This Git user is used for all projects.
Scripts started by the jenkins
user clone and push to and from the repository; The Git user login and password must be set as per this page:
[2]
SSH
One possibility is to have a user (jenkins on a CI) have an SSH key to be added to the GitHub account for that Linux user. For instance, log in as 'jenkins' on the CI system. Then generate an SSH is it does not already exist, and add the SSH key to the GitHub account. To do so, follow the instructions listed at https://help.github.com/articles/generating-an-ssh-key/ .
.netrc
A possible alternative to the SSH key route is using .netrc.
The following is an example of a ~jenkins/.netrc
file on Unix:
machine github.com login gitUserName password gitPassword
And on the command line, make sure the following is entered:
git config --global user.email "you@example.com" git config --global user.name "Your Name"
Test
Make sure you can clone some repository using git clone, without having to enter at the prompt the login and password of the Git user.