@@ -76,14 +76,14 @@ function config_git_profile() {
7676 echo_section " Setup Git Profile"
7777 echo " Requires Git before"
7878
79- read -r -p " Set new Git user name (global): " _gitUserName
80- read -r -p " Set new Git user email (global): " _gitUserEmail
81- read -r -p " Set new Git Default Branch (global): " _defaultBranch
79+ read -r -p " Set new Git user name (global): " git_user_name
80+ read -r -p " Set new Git user email (global): " git_user_email
81+ read -r -p " Set new Git Default Branch (global): " default_branch
8282
8383 # Use variables to make life easier
84- git config --global user.name " $_gitUserName "
85- git config --global user.email " $_gitUserEmail "
86- git config --global init.defaultBranch " $_defaultBranch "
84+ git config --global user.name " $git_user_name "
85+ git config --global user.email " $git_user_email "
86+ git config --global init.defaultBranch " $default_branch "
8787
8888 echo " Your Git name (global): $( git config --global user.name) "
8989 echo " Your Git email (global): $( git config --global user.email) "
@@ -94,31 +94,31 @@ function config_git_profile() {
9494function set_ssh_key() {
9595 echo_section " Setting SSH Key"
9696
97- local _sshPath =~ /.ssh
98- local _sshEncryptionType =ed25519
99- local _sshDefaultFileName =" id_$_sshEncryptionType "
97+ local ssh_path =~ /.ssh
98+ local ssh_encryption_type =ed25519
99+ local ssh_default_file_name =" id_$ssh_encryption_type "
100100
101- echo " Creating folder on '$_sshPath '"
102- mkdir --parents " $_sshPath "
103- pushd " $_sshPath " || exit
101+ echo " Creating folder on '$ssh_path '"
102+ mkdir --parents " $ssh_path "
103+ pushd " $ssh_path " || exit
104104
105105 echo " I recommend you save your passphrase somewhere, in case you don't remember."
106- echo " Generating new SSH Key on $_sshPath / $_sshDefaultFileName "
106+ echo " Generating new SSH Key on $ssh_path / $ssh_default_file_name "
107107
108- if [[ -f " $_sshPath / $_sshDefaultFileName " ]]; then
109- echo " $_sshPath / $_sshDefaultFileName already exists"
108+ if [[ -f " $ssh_path / $ssh_default_file_name " ]]; then
109+ echo " $ssh_path / $ssh_default_file_name already exists"
110110 else
111- echo " $_sshPath / $_sshDefaultFileName does not exists | Creating..."
111+ echo " $ssh_path / $ssh_default_file_name does not exists | Creating..."
112112 echo " Using your email from git to create a SSH Key: $( git config --global user.email) "
113113 # Generate a new ssh key, passing every parameter as variables (Make sure to config git first)
114- ssh-keygen -t $_sshEncryptionType -C " $( git config --global user.email) SSH Signing Key" -f " $_sshDefaultFileName "
114+ ssh-keygen -t $ssh_encryption_type -C " $( git config --global user.email) SSH Signing Key" -f " $ssh_default_file_name "
115115 fi
116116
117117 echo " Validating files permissions"
118- chmod 600 " $_sshDefaultFileName "
118+ chmod 600 " $ssh_default_file_name "
119119
120120 echo " Adding your private keys"
121- ssh-add " $_sshDefaultFileName "
121+ ssh-add " $ssh_default_file_name "
122122 popd || exit
123123}
124124
@@ -128,7 +128,7 @@ function set_gpg_key() {
128128 gpg --list-signatures # Use this instead of creating the folder, fix permissions
129129 pushd ~ /.gnupg || exit
130130 echo_caption " Importing GPG keys"
131- gpg --import * .gpg
131+ gpg --import ./ * .gpg
132132
133133 echo " Setting up GPG signing key"
134134 # Code adapted from: https://stackoverflow.com/a/66242583 # My key name
@@ -142,20 +142,20 @@ function set_gpg_key() {
142142
143143function import_keys_gpg_ssh() {
144144 echo " TIP: Go to the folder using a terminal and type 'pwd', use the output to paste on the request below"
145- read -r -p " Select the existing GPG keys folder (accepts only .gpg file format): " _folder
145+ read -r -p " Select the existing GPG keys folder (accepts only .gpg file format): " folder
146146
147- echo_caption " Importing GPG keys from: $_folder "
148- pushd " $_folder " || exit
149- gpg --import " $_folder " /* .gpg
147+ echo_caption " Importing GPG keys from: $folder "
148+ pushd " $folder " || exit
149+ gpg --import " $folder " /* .gpg
150150
151151 # Get the exact key ID from the system
152152 # Code adapted from: https://stackoverflow.com/a/66242583
153- echo " $( gpg --list-signatures --with-colons | grep ' sig' ) "
153+ gpg --list-signatures --with-colons | grep ' sig'
154154
155155 echo_caption " From those keys, select an e-mail address"
156- read -r -p " To select one of the keys, type a valid e-mail: " _identifier
156+ read -r -p " To select one of the keys, type a valid e-mail: " identifier
157157
158- key_id=$( gpg --list-signatures --with-colons | grep ' sig' | grep " $_identifier " | head -n 1 | cut -d' :' -f5)
158+ key_id=$( gpg --list-signatures --with-colons | grep ' sig' | grep " $identifier " | head -n 1 | cut -d' :' -f5)
159159 echo_error " Using key: $key_id "
160160 git config --global user.signingkey " $key_id "
161161 # Always commit with GPG signature
@@ -164,16 +164,16 @@ function import_keys_gpg_ssh() {
164164
165165 echo
166166 echo " TIP: Go to the folder using a terminal and type 'pwd', use the output to paste on the request below"
167- read -r -p " Select the existing SSH keys folder (accepts any file format): " _folder
167+ read -r -p " Select the existing SSH keys folder (accepts any file format): " folder
168168
169- echo_caption " Importing SSH keys from: $_folder "
170- pushd " $_folder " || exit
169+ echo_caption " Importing SSH keys from: $folder "
170+ pushd " $folder " || exit
171171
172172 echo " Validating files permissions"
173- chmod 600 " $_folder " /*
173+ chmod 600 " $folder " /*
174174
175175 echo " Adding your private keys"
176- ssh-add " $_folder " /*
176+ ssh-add " $folder " /*
177177 popd || exit
178178}
179179
0 commit comments