Since the deprecation of basic authentication (password-based authentication) for Git operations, it is now necessary to use either a SSH key or a personal access token to authenticate Git operations. The Technical Council recommends using the SSH authentication method. While SSH keys can be read-only or read-write enabled, or scoped to specific repositories, the chief advantage of using SSH keys for authentication is not having to enter your username and Personal Access Token with every Git operation. Although a personal access token has a finer-grained permissions model in comparison, SSH keys have a better security profile than Personal Access Tokens as they are not transmitted with every Git operation.
Generate a new SSH key on your local machine following the instructions below. After completing these steps and generating your SSH key pair, follow the Adding the SSH key to GitHub instructions to enable SSH authentication for Git operations.
Open Terminal. Paste the text below, substituting in your GitHub email address.
ssh-keygen \-t ed25519 \-C "YOUR_NAME@gmail.com"
Generating public/private ALGORITHM key pair"Enter a file in which to save the key", you can press Enter to accept the default file location. Please note that if you created SSH keys previously, ssh-keygen may ask you to rewrite another key, in which case we recommend creating a custom-named SSH key. To do so, type the default file location and replace id_ssh_keyname with your custom key name.(/home/YOU/.ssh/ALGORITHM):\[Press enter\]At the prompt, type a secure passphrase. For more information, see “Working with SSH key passphrases.”
Enter passphrase (empty for no passphrase): \[Type a passphrase\]
Enter same passphrase again: \[Type passphrase again\]
You should get a message which includes the file path to your private and public keys
Your identification has been saved in /home/your_name/.ssh/id\_ed25519
Your public key has been saved in /home/your_name/.ssh/id\_ed25519.pub
Paste the following command to list the public key for GitHub. Usually, the public key has the suffix '.pub'.
cat \~/.ssh/id\_ed25519.pub
The following procedure was written and provided by Joey Takeda.
cd. For example, if you have created a folder for GitHub, enter cd GitHub.git clone, and then paste the URL you copied earlier: git clone git@github.com:TEIC/TEI.gitgit clone git@github.com:TEIC/Stylesheets.gitWhen cloning a repository it is possible that you might encounter some errors.
If you are unable to clone a repository, check that:
The following instructions are intended for users who are using Oxygen and the Git Client plugin.
https://github.com/TEIC/TEI.git.If you have already cloned the TEIC repositories via the command line using the password-protected SSH key as follows git clone [git@github.com](mailto:git@github.com):TEIC/TEI.git, you may be receiving an error message in the Git Staging tab in Oxygen stating that the cloned repositories cannot be reached.
The following procedure documents how you can resolve this error message by adding the URL for the remote repository.
| Command | Function |
|---|---|
| docker start -ai tei | Starts the docker container for the TEI repositories |
| cd tei | Changes directory to the docker container for the TEI repositories |
| cd /tei/TEI/P5 | Store the local builds within the docker container with the TEI repo, put them in the P5 folder |
| make clean validate html-web | To clean (delete previous builds) and validate and build the TEI web pages locally. (Note: after the process finishes, you’ll have a directory called “Guidelines-web” in your P5 directory. Outside your Docker shell, you can browse to this folder, find the index.html file, and open it in a browser.) |
| make clean validate | |
| make test | |
| make clean validate html-web test exemplars | |
| time make clean validate html-web test exemplars | |
| Ctrl + Shift + D | Exit out of docker |
cd /mnt/c/Users/trish/GitHub/TEI/P5/.git status.git pull.yourname\_issuenumber: git checkout \-b trishaoconnor\_2356."Insert message here"): git commit -a -m "Insert summary of change(s) here"git push --set-upstream origin trishaoconnor\_2356git checkout devtrishaoconnor\_XXXX, enter git checkout trishaoconnor\_XXXX.git pull.git merge -m "Add whatever is new in dev" dev.git status -uno.git push to push commits to the branch.| Command | Function |
|---|---|
| git checkout my-pull-request-branch | Change to your pull request branch ie. git checkout trishaoconnor_tcw31update |
| git rebase -i HEAD~n | Replace the n with the number of commits that you wish to rebase ie. git rebase -i HEAD~8 For the number of commits, check the pull request on GitHub |
Replace pick with drop for the commits you want to discard. |
A list of commits is generated, there will be a line for each commit which will contain the text pick <commit id>. The default label for each commit in the file is pick, so for every commit you want to drop, manually change the text pick to drop |
| Save your changes and exit the editor (Ctrl + X) | |
| git push --force-with-lease | Pushes your changes to the pull request, removing any commits that you marked as drop and adding only the commits that you left marked as pick |
$ git remote add YOUR\_LOCAL\_NAME\_FOR\_OTHER\_REPO URL\_OF\_OTHER\_REPO
$ git fetch YOUR\_LOCAL\_NAME\_FOR\_OTHER\_REPO
$ git checkout \-b YOUR\_LOCAL\_NAME\_FOR\_BRANCH YOUR\_LOCAL\_NAME\_FOR\_OTHER\_REPO/BRANCH\_NAME\_IN\_OTHER\_REPO
$ git pull
$ \# make & commit changes as needed
$ git push YOUR\_LOCAL\_NAME\_FOR\_OTHER\_REPO HEAD:BRANCH\_NAME\_IN\_OTHER\_REPO
| Example (cf. [#2691)] (https://github.com/TEIC/TEI/pull/2691)) |
|---|
git remote add jbampton git@github.com:jbampton/TEI.git |
git fetch jbampton |
git checkout \-b jbampton\_fix-spelling jbampton/fix-spelling |
git pull |
| Example (cf. #2844) |
|---|
git remote add rettinghaus git@github.com:rettinghaus/TEI.git |
git fetch rettinghaus |
git checkout \-b rettinghaus\_issue-2459 rettinghaus/issue-2459 |
git pull |
git push rettinghaus HEAD:issue-2459 |
| Command | Function |
|---|---|
| git stash | Stashes your uncommitted local changes |
| git checkout branch2 | Switches to branch2 (change with your_name_2 etc) |
| git checkout -b branch2 | Creates and switches to new branch |
| git stash pop | Pops your stash of uncommitted local changes into the new branch |