I have always had a lot of difficulty with github.
I have jotted down a few things which might help some new kernel builders.
A. Github Setup
- Go to github and Open a new Repo
I called mine “physwizz_kernel” - To set up SSH key
$ git config –global user.email “you@example.com”
$ git config –global user.name “Your Github Name”
$ ssh-keygen -t rsa -b 4096 -C “you@example.com”
Press enter 3 times
$ eval “$(ssh-agent -s)”
$ ssh-add ~/.ssh/id_rsa
$ sudo apt-get install xclip
$ xclip -sel clip < ~/.ssh/id_rsa.pub
- The SSH key will be in clipboard
Go to github settings => SSH and GPG keys
New SSH key
Paste key here
B. Using github
- Open Terminal In The Kernel Folder
$ git init
$ git remote add origin (github id) mine is git@github.com: physwizz/physwizz_kernel.git
$ touch README
$ git add README
$ git add –all
$ git commit -m “Initial commit”
$ git push -u origin main
If you don’t see the files on the GitHub repo you might need to
$ got commit -a
Ctrl-o
Initial
Ctrl-x
$ git push origin main -f
- To cherry pick a commit from another github repository
firstly add the other repository to your kernel
$ git remote add other https:
$ git fetch –all
$ git cherry-pick [hash_id]
$ git config merge.renameLimit 999999
To cherry-pick a range of commits
$ git cherry-pick [first hash_id]^..[last hash_id]
Sometimes you get extra lines of text in one of the files that should be deleted. The log on screen will tell you which file is corrupt.
Search the file for odd lines like this.
Txt txt txt txt
Head
<<<<
correct the errors and type
git commit -a
ctrl-o enter ctrl-x
git push origin main -f
git cherry-pick —continue
- to push changes to github
$ make clean && make mrproper
$ git add –all
if the change is your own
$ git commit -a -m “message”
Or
$ git commit -a
write comment
ctrl o (to output)
enter
ctrl x (to exit)
then
$ git push origin main
if the change is a cherry pick
$ git commit “change made” –author=”Author’s name”
then
$ git push origin main
- If it doesn’t work or if you want to try something else
$ git revert
$ git push origin main
Or
$ git reset –hard < last clean commit hash >
$ git push origin main -f
$ git cherry pick
$ git push origin main
- to edit last commit
$ git commit –amend -e
$ git push origin main
- Don’t use
$git add –all
after you build