auth_gitlab
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
auth_gitlab [2019/06/21 14:32] – created apano | auth_gitlab [2019/12/03 15:27] – [Add an SSH key] apano | ||
---|---|---|---|
Line 3: | Line 3: | ||
Since July 2016 we use [[https:// | Since July 2016 we use [[https:// | ||
- | UNIBZ users have to login to [[https:// | + | UNIBZ users have to login to [[https:// |
- | External users can sign up with their Google, Twitter, | + | External users can sign up with their Google, Github, Twitter, Facebook, Bitbucket or Microsoft |
Here are some instructions on GitLab to ease its use. | Here are some instructions on GitLab to ease its use. | ||
Line 15: | Line 15: | ||
You can have different hosts for different Git repositories which you access via specific username/ | You can have different hosts for different Git repositories which you access via specific username/ | ||
+ | |||
+ | You can either clone/ | ||
+ | |||
The steps for pushing and pulling via SSH Key | The steps for pushing and pulling via SSH Key | ||
- | * Step 1: [[auth:gitlab# | + | * Step 1: [[auth_gitlab# |
- | * Step 2: [[auth:gitlab# | + | * Step 2: [[auth_gitlab# |
- | * Step 3: [[auth:gitlab# | + | * Step 3: [[auth_gitlab# |
===== Identify or create the SSH key ===== | ===== Identify or create the SSH key ===== | ||
- | If you need support | + | |
+ | You need an SSH key that resides | ||
+ | |||
+ | ==== Check for an existing SSH key ==== | ||
+ | |||
+ | If you already have an SSH key you will probably find it here: | ||
+ | |||
+ | Linux/macOS : ~/ | ||
+ | |||
+ | Windows : %userprofile%\.ssh\id_rsa.pub | ||
+ | |||
+ | |||
+ | Open the file with a text editor and check if it has contents. Typically it starts with ssh-rsa or ssh-ed25519. If it has contents [[auth: | ||
+ | |||
+ | ==== Generate an SSH key ==== | ||
+ | Open a terminal on Linux or macOS, or Git Bash on Windows and run the command: | ||
+ | < | ||
+ | or | ||
+ | < | ||
+ | |||
+ | You can check your e-mail | ||
+ | |||
+ | When you are asked for a location and file name you can either keep the default location or choose a new one. If this is your only key we advice you accept the defaults and maintain the file name id_rsa. Should you have several keys you can name them according to your own preferences. [[https:// | ||
+ | |||
+ | Add the key to your ssh agent by issuing this commands on Linux/macOS or Git Bash for Windows (adapt to your id_rsa path): | ||
+ | |||
+ | < | ||
+ | $ eval " | ||
+ | $ ssh-add -K ~/ | ||
+ | </ | ||
+ | |||
+ | Note: You can also use a key generator such as [[http:// | ||
===== Add an SSH key ===== | ===== Add an SSH key ===== | ||
- | If you already have an SSH key login to GitLab | + | Login to Gitlab |
- | Once you click Add Key, you will see the it listed. | + | |
+ | In the field Key copy the contents of the file: id_rsa.pub (or any other file containing your key). | ||
+ | |||
+ | Choose a name to identify the key (ex. YourComputerName) and click Add Key, you will see the it listed. | ||
===== Configure your local Git Client ===== | ===== Configure your local Git Client ===== | ||
Before proceeding check if your GIT client is already configured. | Before proceeding check if your GIT client is already configured. | ||
- | LINUX/MACOSX | + | In Linux/macOS terminal or Windows |
- | If you use only one server | + | This command lists any existing GIT repositories configurations. |
- | + | If you have an already existing configuration choose a local configuration (folder specific) | |
- | ==== Global | + | ==== Global configuration ==== |
- | To configure GIT globally using the SSH key Inside | + | To configure GIT globally using the SSH key inside |
< | < | ||
git config --global user.name " | git config --global user.name " | ||
- | git config --global user.email "your_email@unibz.it" | + | git config --global user.email "your@email" |
git config --list | git config --list | ||
</ | </ | ||
- | This data is stored in your gitconfiguration file: | + | Add your server data in your ssh configuration file. Verify the path is correct |
- | Linux/Mac: ~/ | + | |
- | Windows: C: | + | |
- | + | ||
- | The content should be: | + | |
- | <code txt> | + | |
- | [user] | + | |
- | name = Lastname Firstname | + | |
- | email = your_email@unibz.it | + | |
- | </ | + | |
- | + | ||
- | Add your server | + | |
Linux/Mac file ~/ | Linux/Mac file ~/ | ||
< | < | ||
host gitlab.inf.unibz.it | host gitlab.inf.unibz.it | ||
+ | | ||
user your_username | user your_username | ||
+ | | ||
</ | </ | ||
Line 66: | Line 94: | ||
< | < | ||
Host gitlab.inf.unibz.it | Host gitlab.inf.unibz.it | ||
- | RSAAuthentication yes | + | RSAAuthentication yes |
- | IdentityFile ~/ | + | |
</ | </ | ||
+ | The data on the global Git configuration is stored in the file (Linux/ | ||
+ | |||
+ | The content would be (if configured): | ||
+ | <code txt> | ||
+ | [user] | ||
+ | name = Lastname Firstname | ||
+ | email = your@email | ||
+ | </ | ||
==== Local Configuration ==== | ==== Local Configuration ==== | ||
You have to run the commands inside the directory where you want your repository to be. From terminal/ | You have to run the commands inside the directory where you want your repository to be. From terminal/ | ||
<code txt> | <code txt> | ||
- | cd repository_folder | + | cd repository_folder_in_your_computer |
git config user.name " | git config user.name " | ||
- | git config user.email "your_other@email" | + | git config user.email "your@email" |
</ | </ | ||
Should you receive this message | Should you receive this message | ||
git init | git init | ||
- | </ | + | </ |
===== Basic Git ===== | ===== Basic Git ===== |
/data/www/wiki.inf.unibz.it/data/pages/auth_gitlab.txt · Last modified: 2020/04/02 11:25 by apano