Github git
From wikinotes
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/githubDeploy Keys
you can generate keys to provide read-only, or read-write access to a repo.
ssh-keygen -t ed25519 # a strong keyhttps://github.com/<you>/<repo>/settings/keys/new # url to add new deploykeynext we'll create entries within our ssh config for the repo.
Create an `alias` for github.com, that will identify which deploykey you'll be using here.
Host <alias-for-your-repo> github.com HostName github.com IdentityFile /home/you/.ssh/deploykey User git
Finally, clone the git repository using your alias instead of github.com.git clone <alias-for-your-repo>:<you>/<repo>NOTE:
Your alias must be a word, not a full address. Some examples:
- git will not recognize
myrepo:/you/myrepo
as an alias- your alias cannot resolve to your repo ex:
git clone {alias}
is not sufficient. You will need to usegit clone {alias}:you/repo
.
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