Github git: Difference between revisions
From wikinotes
No edit summary |
|||
Line 1: | Line 1: | ||
= | = SSH Keys = | ||
<blockquote> | <blockquote> | ||
== Push/Pull with SSH key == | |||
= | |||
<blockquote> | <blockquote> | ||
You'll need to change the github URL you are using. | You'll need to change the github URL you are using. | ||
Line 39: | Line 16: | ||
ssh git@github.com -i ~/.ssh/github | ssh git@github.com -i ~/.ssh/github | ||
</source> | </source> | ||
</blockquote><!-- | </blockquote><!-- Push/Pull with ssh key --> | ||
</blockquote><!-- SSH Keys --> | |||
= | = Workflows = | ||
<blockquote> | |||
== Importing existing repo == | |||
<blockquote> | <blockquote> | ||
See [[git httpserver|hosting a git http server]] to share with github. | See [[git httpserver|hosting a git http server]] to share with github. | ||
You can then use that to import your project. | You can then use that to import your project. | ||
</blockquote><!-- importing an existing repo --> | |||
== Download single file == | |||
<blockquote> | |||
<source lang="bash"> | |||
curl -O wget https://raw.githubusercontent.com/user/project/branch/filename | |||
</source> | |||
</blockquote><!-- Download single file --> | |||
== Find PR from commit == | |||
<blockquote> | |||
<source lang="bash"> | |||
git log --merges --ancestry-path --oneline 9c34e5f6af..master \ | |||
| grep 'pull request' \ | |||
| tail -n1 \ | |||
| awk '{print $5}' \ | |||
| cut -c2- \ | |||
| xargs gh pr view -w | |||
</source> | |||
</blockquote><!-- | alternatively | ||
<source lang="bash"> | |||
git describe --all --contains <commit> # returns branch name | |||
</source> | |||
</blockquote><!-- Find PR from commit --> | |||
</blockquote><!-- Workflows --> |
Revision as of 15:39, 19 September 2021
SSH Keys
Push/Pull with SSH key
You'll need to change the github URL you are using.
git clone https://github.com/<Username>/<Project> # !!bad!! git clone git@github.com:<Username>/<Project> # good git clone github.com:<username>/<project> # also good (must specify user in ~/.ssh/config)You can quickly test authentication
ssh git@github.com -i ~/.ssh/github
Workflows
Importing existing repo
See hosting a git http server to share with github.
You can then use that to import your project.
Download single file
curl -O wget https://raw.githubusercontent.com/user/project/branch/filenameFind PR from commit
git log --merges --ancestry-path --oneline 9c34e5f6af..master \ | grep 'pull request' \ | tail -n1 \ | awk '{print $5}' \ | cut -c2- \ | xargs gh pr view -walternatively
git describe --all --contains <commit> # returns branch name