Folders/files not updated to Github? - github

I'm still very new to all these so please be patient with me.
I've recently changed my GitHub username and that is when I started noticing this issue: files or folders that are manually created on VS code or in the windows folder don't get uploaded onto GitHub. Whenever I try git add. & commit commands, I get this error message below:
warning: could not open directory '.vscode/': Permission denied
However, if I create a file on GitHub itself, say an index HTML file, it shows up on my windows folder. I can push any changes to this HTML file made on VS code and it shows up GitHub.
I have provided the log below if it's of any help.
Looking for git in: C:\Program Files\Git\cmd\git.exe
Using git 2.27.0.windows.1 from C:\Program Files\Git\cmd\git.exe
> git rev-parse --git-dir
Open repository: c:\Users\raeye\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\raeyean\code\raeleneho\todoapp
> git status -z -u
> git symbolic-ref --short HEAD
> git rev-parse main
> git config --global user.email
> git check-ignore -v -z --stdin
> git rev-parse --symbolic-full-name main#{u}
> git rev-list --left-right main...refs/remotes/origin/main
> git for-each-ref --sort -committerdate --format %(refname) %(objectname)
> git remote --verbose
> git config --get commit.template
> git show --textconv :html/todoList.html
> git ls-files --stage -- C:\Users\raeye\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\raeyean\code\raeleneho\todoapp\html\todoList.html
> git show --textconv :.vscode/settings.json
> git ls-files --stage -- C:\Users\raeye\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\raeyean\code\raeleneho\todoapp\.vscode\settings.json
> git show --textconv :html/todoList.html
> git ls-files --stage -- C:\Users\raeye\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\raeyean\code\raeleneho\todoapp\html\todoList.html
> git status -z -u
> git symbolic-ref --short HEAD
> git rev-parse main
> git rev-parse --symbolic-full-name main#{u}
> git rev-list --left-right main...refs/remotes/origin/main
> git for-each-ref --sort -committerdate --format %(refname) %(objectname)
> git remote --verbose
> git config --get commit.template
> git status -z -u
> git symbolic-ref --short HEAD
> git rev-parse main
> git rev-parse --symbolic-full-name main#{u}
> git rev-list --left-right main...refs/remotes/origin/main
> git for-each-ref --sort -committerdate --format %(refname) %(objectname)
> git remote --verbose
> git config --get commit.template
> git status -z -u
> git ls-files --stage -- C:\Users\raeye\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\raeyean\code\raeleneho\todoapp\html\todoList.html
> git symbolic-ref --short HEAD
> git show --textconv :html/todoList.html
> git rev-parse main
> git rev-parse --symbolic-full-name main#{u}
> git rev-list --left-right main...refs/remotes/origin/main
> git for-each-ref --sort -committerdate --format %(refname) %(objectname)
> git remote --verbose
> git config --get commit.template
> git init
error: could not write config file C:/Users/raeye/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/home/raeyean/code/raeleneho/todoapp/.git/config: Permission denied
fatal: could not set 'core.repositoryformatversion' to '0'
> git status -z -u
> git ls-files --stage -- C:\Users\raeye\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\raeyean\code\raeleneho\todoapp\html\todoList.html
> git symbolic-ref --short HEAD
> git rev-parse main
> git show --textconv :html/todoList.html
> git rev-parse --symbolic-full-name main#{u}
> git rev-list --left-right main...refs/remotes/origin/main
> git for-each-ref --sort -committerdate --format %(refname) %(objectname)
> git remote --verbose
> git config --get commit.template
> git status -z -u
> git ls-files --stage -- C:\Users\raeye\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\raeyean\code\raeleneho\todoapp\html\todoList.html
> git show --textconv :html/todoList.html
> git symbolic-ref --short HEAD
> git rev-parse main
> git rev-parse --symbolic-full-name main#{u}
> git rev-list --left-right main...refs/remotes/origin/main
> git for-each-ref --sort -committerdate --format %(refname) %(objectname)
> git remote --verbose
> git config --get commit.template

If you can fetch but not push, that means your repository is a public one, but your git config credential.helper, probably set to manager (even in your WSL2 Ubuntu session), has cached the wrong credential.
Try and type:
cd /path/to/repo
git remote set-url origin https://<myNewGitHubAccount>#github.com/<myNewGitHubAccount>/myRepo
Then try and push again: a popup should ask for your GitHub Account password (or better yet, for a PAT -- Personal Access Token)
If you go the SSH route, make sure to follow "Connecting to GitHub with SSH
", and check if ssh -Tv git#github.com does end up with a welcome message.

Related

git rebase - pop each commit into working dir to easily edit, re-use commit msg

The git-rebase edit command seems to have the right idea, but we have to run git undo; git reset; to make changes available to edit....
Is there a good way to be able to cruise through an entire set of commits, pop each one into the working dir, one after the next?
Before I submit my PRs, I like to go through my commits. Instead of just looking at a read-only diff, I want to live edit each commit, as if I had just written it.
I also want the commit message to be pre-populated, don't want to go hunting for the correct commit message each time.
As you mentioned, the edit cmd inside git-rebase doesn't quite do all the steps you need to do to actually edit (mutate) a commit.
First, you may decide, you don't want to look at merge conflicts.
git rebase --strategy recursive --strategy-option theirs -i <base-sha>
Since you are going to check/edit each commit... if you aren't changing too many things, you should be able to spot what is wrong about a commit, based on a previous change you did. Notably, if you added a code comment in an early commit, and saw a subsequent commit deletes that comment, you should simply restore the comment. This is easy in vscode's side by side diff view (which I use all the time).
Finally, we do need to use some sort of rebase exec command to pop changes into our working directory:
exec MSG=$(git log -1 --format=%B HEAD); git undo; git reset; echo "$MSG" > $GIT_DIR/LAST_COMMIT_MSG; echo "editing commit:\n\n$MSG\n";
Maybe, you use vscode, we can also open the edited files for you:
code $(git diff --staged --name-only)
UPDATE: This doesn't open the actual diffs, so is a waste for me, not included in final command. Maybe a vscode shortcut key would work, or if this entire review flow was simply packaged up into a vscode extension.
This exec command will always fail, so we'll want --no-reschedule-failed-exec
// Putting it all together ... there are further changes below.
GIT_SEQUENCE_EDITOR=: git rebase --exec 'MSG=$(git log -1 --format=%B HEAD); git undo; git restore --staged $(git diff --name-only --staged --diff-filter=r); echo "$MSG" > $GIT_DIR/LAST_COMMIT_MSG; echo "editing commit:\n\n$MSG\n";' --strategy recursive --no-reschedule-failed-exec --strategy-option theirs -i 315abbd5b
To cycle onto the next commit, simply run:
git add --all && git commit && git rebase --continue
We'll then need this prepare-commit-msg script to re-use the LAST_COMMIT_MSG file:
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
COMMIT_MSG_FILE=$1
# COMMIT_SOURCE=$2
# SHA1=$3
if [ -f $GIT_DIR/LAST_COMMIT_MSG ]; then
cat $GIT_DIR/LAST_COMMIT_MSG $COMMIT_MSG_FILE > temp_commit_msg && mv temp_commit_msg $COMMIT_MSG_FILE
rm $GIT_DIR/LAST_COMMIT_MSG
fi
Add this few hooks to wipe any stale LAST_COMMIT_MSG:
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
echo "some git-hook: wiping $GIT_DIR/LAST_COMMIT_MSG: $(cat $GIT_DIR/LAST_COMMIT_MSG)"
rm $GIT_DIR/LAST_COMMIT_MSG
This way, you just run git commit when you are done editing a commit, and, you'll get to re-use/tweak the original commit message.
If using husky, you'll need to:
echo ".husky/prepare-commit-msg" >> $(git rev-parse --show-toplevel)/../main-worktree/.git/info/exclude
echo ".husky/pre-rebase" >> $(git rev-parse --show-toplevel)/../main-worktree/.git/info/exclude
echo ".husky/post-rewrite" >> $(git rev-parse --show-toplevel)/../main-worktree/.git/info/exclude
echo ".husky/post-commit" >> $(git rev-parse --show-toplevel)/../main-worktree/.git/info/exclude
# paste it in:
code -n .husky/prepare-commit-msg .husky/pre-rebase .husky/post-rewrite .husky/post-commit
chmod +x .husky/prepare-commit-msg
chmod +x .husky/pre-rebase
chmod +x .husky/post-rewrite
chmod +x .husky/post-commit
UPDATE:
This whole command becomes quite a bear, so let's use an alias to clean it up:
git config --global --edit
Add few aliases:
next = "!sh -c 'git add --all && git commit $# && git rebase --continue' -"
redo = !echo "$(git log -1 --format=%B HEAD)" > $GIT_DIR/LAST_COMMIT_MSG && git undo && git restore --staged $(git diff --name-only --staged --diff-filter=ard) > /dev/null 2>&1 || true && cat $GIT_DIR/LAST_COMMIT_MSG && echo '' && git -c advice.addEmptyPathspec=false add -N $(git ls-files --others --exclude-standard) > /dev/null 2>&1 || true
review-stack = "!GIT_SEQUENCE_EDITOR=: git rebase --exec 'git redo' --strategy recursive --no-reschedule-failed-exec --strategy-option theirs --interactive"
Finally, using alias:
git review-stack 315abbd5b
# Go to next commit, no frills:
git next --no-edit --no-verify
# If you made changes:
git next
Prep:
Add these git alias's:
git config --global --edit
Paste in
[alias]
next = "!sh -c 'git add --all && git commit $# && git rebase --continue' -"
redo = !echo "$(git log -1 --format=%B HEAD)" > $GIT_DIR/LAST_COMMIT_MSG && git undo && git restore --staged $(git diff --name-only --staged --diff-filter=ard) > /dev/null 2>&1 || true && cat $GIT_DIR/LAST_COMMIT_MSG || true && echo '' && git -c advice.addEmptyPathspec=false add -N $(git ls-files --others --exclude-standard) > /dev/null 2>&1 || true
redo is a beast, I am NOT good at bash, basically cobbled this together using google + SO
To pre-populate COMMIT_EDITMSG with your last commit message, setup these git hooks. Instructions here are just for husky for now, if you aren't using husky, it's even easier, just put hooks into .git/hooks dir.
# using worktrees:
LOCAL_GITIGNORE=$(git rev-parse --show-toplevel)/../main-worktree/.git/info/exclude
# not using worktrees:
LOCAL_GITIGNORE=$(git rev-parse --show-toplevel)/.git/info/exclude
echo ".husky/prepare-commit-msg" >> $LOCAL_GITIGNORE
echo ".husky/pre-rebase" >> $LOCAL_GITIGNORE
echo ".husky/post-rewrite" >> $LOCAL_GITIGNORE
echo ".husky/post-commit" >> $LOCAL_GITIGNORE
chmod +x .husky/prepare-commit-msg
chmod +x .husky/pre-rebase
chmod +x .husky/post-rewrite
chmod +x .husky/post-commit
code .husky/prepare-commit-msg .husky/pre-rebase .husky/post-rewrite .husky/post-commit
.husky/prepare-commit-msg is unique:
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
COMMIT_MSG_FILE=$1
# COMMIT_SOURCE=$2
# SHA1=$3
if [ -f $GIT_DIR/LAST_COMMIT_MSG ]; then
# vscode commits happen to run with this command:
# git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file - [3774ms]
# So, we won't want to use the last commit message in that case.
# LAST_COMMIT_MSG will be cleaned up post-commit, if commit succeeds
#
# TODO:
# if commit msg from vscode is empty (first line of $COMMIT_MSG_FILE is empty),
# And second line starts with a "#"
# then actually fill in the missing commit message!
# Maybe we can read `COMMIT_SOURCE=$2`
# instead of reading the `$COMMIT_MSG_FILE`
# https://www.google.com/search?q=bash+check+if+first+line+of+file+is+empty
if [ "$(git config user.useConfigOnly)" != "true" ]; then
cat $GIT_DIR/LAST_COMMIT_MSG $COMMIT_MSG_FILE > temp_commit_msg && mv temp_commit_msg $COMMIT_MSG_FILE
# It's been used once, get rid of it?
# rm $GIT_DIR/LAST_COMMIT_MSG;
# This is cleaned up in post-commit hook.
# So you can abort commit, edit more, re-commit, and still retain this commit message.
fi
fi
The remaining 3 are all the same:
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
if [ -f $GIT_DIR/LAST_COMMIT_MSG ]; then
# echo "some git hook: wiping $GIT_DIR/LAST_COMMIT_MSG: $(cat $GIT_DIR/LAST_COMMIT_MSG)"
rm $GIT_DIR/LAST_COMMIT_MSG
fi
Launch it!
git rebase --exec 'git redo' -i 315abbd5b
next commit
git next
To focus in on a certain variable name throughout a PR, you could run:
git rebase --exec 'ag -0 -l newVarNameOfInterest app/greenfield/project && git redo || echo "ok"' -i 315abbd5b
to install ag run brew install the_silver_searcher

Visual Studio Code (Git: Bad status code: 500)

I am trying to commit changes from my Flutter codes to my GitHub repositories but this error keeps showing up.
This is the gitlog.
I want to sync it to GitHub.
Also, how can I disconnect my local code to a repository in GitHub since this error keeps showing off?
[2022-07-09T08:38:34.408Z] Log level: Info
[2022-07-09T08:38:34.409Z] [info] Validating found git in: C:\Program Files\Git\cmd\git.exe
[2022-07-09T08:38:34.557Z] [info] Using git 2.36.0.windows.1 from C:\Program Files\Git\cmd\git.exe
[2022-07-09T08:38:35.008Z] > git rev-parse --show-toplevel [440ms]
[2022-07-09T08:38:35.627Z] > git rev-parse --git-dir --git-common-dir [603ms]
[2022-07-09T08:38:35.638Z] [info] Open repository: c:\Users\JHON MICHEAL\Downloads\grabbitapp-v1.0.9
[2022-07-09T08:38:36.070Z] > git status -z -uall [413ms]
[2022-07-09T08:38:36.154Z] > git fetch [506ms]
[2022-07-09T08:38:36.284Z] > git symbolic-ref --short HEAD [210ms]
[2022-07-09T08:38:36.518Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/main refs/remotes/main [230ms]
[2022-07-09T08:38:36.839Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [317ms]
[2022-07-09T08:38:36.840Z] > git remote --verbose [314ms]
[2022-07-09T08:38:37.181Z] > git config --get commit.template [322ms]
[2022-07-09T08:38:37.646Z] > git status -z -uall [459ms]
[2022-07-09T08:38:37.722Z] > git check-ignore -v -z --stdin [326ms]
[2022-07-09T08:38:37.944Z] > git ls-files --stage -- C:\Users\JHON MICHEAL\Downloads\grabbitapp-v1.0.9\lib\main.dart [375ms]
[2022-07-09T08:38:38.019Z] > git symbolic-ref --short HEAD [354ms]
[2022-07-09T08:38:38.029Z] > git show --textconv :lib/main.dart [484ms]
[2022-07-09T08:38:38.211Z] > git cat-file -s 5d6402f0276f3fd5b022360f84c102449513b154 [263ms]
[2022-07-09T08:38:38.283Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/main refs/remotes/main [260ms]
[2022-07-09T08:38:38.614Z] > git ls-files --stage -- C:\Users\JHON MICHEAL\Downloads\grabbitapp-v1.0.9\lib\main.dart [385ms]
[2022-07-09T08:38:38.654Z] > git remote --verbose [364ms]
[2022-07-09T08:38:38.655Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [368ms]
[2022-07-09T08:38:38.977Z] > git config --get commit.template [311ms]
[2022-07-09T08:38:38.991Z] > git cat-file -s 5d6402f0276f3fd5b022360f84c102449513b154 [373ms]
[2022-07-09T08:38:39.126Z] > git status -z -uall [137ms]
[2022-07-09T08:38:39.174Z] > git symbolic-ref --short HEAD [45ms]
[2022-07-09T08:38:39.221Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/main refs/remotes/main [44ms]
[2022-07-09T08:38:39.281Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [57ms]
[2022-07-09T08:38:39.282Z] > git remote --verbose [55ms]
[2022-07-09T08:38:39.366Z] > git config --get commit.template [73ms]
[2022-07-09T08:40:45.853Z] > git check-ignore -v -z --stdin [108ms]
[2022-07-09T08:40:48.737Z] > git check-ignore -v -z --stdin [87ms]
[2022-07-09T08:40:51.641Z] > git branch [79ms]
[2022-07-09T08:40:51.763Z] > git rm --cached -r -- . [118ms]
[2022-07-09T08:40:51.763Z] error: the following file has staged content different from both the
file and the HEAD:
.dhiwise/config
(use -f to force removal)
[2022-07-09T08:41:39.111Z] > git fetch [112ms]
[2022-07-09T08:41:39.188Z] > git status -z -uall [69ms]
[2022-07-09T08:41:39.236Z] > git symbolic-ref --short HEAD [43ms]
[2022-07-09T08:41:39.308Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/main refs/remotes/main [69ms]
[2022-07-09T08:41:39.356Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [46ms]
[2022-07-09T08:41:39.359Z] > git remote --verbose [44ms]
[2022-07-09T08:41:39.406Z] > git config --get commit.template [38ms]
[2022-07-09T08:41:40.401Z] > git ls-files --stage -- C:\Users\JHON MICHEAL\Downloads\grabbitapp-v1.0.9\lib\main.dart [39ms]
[2022-07-09T08:41:40.443Z] > git cat-file -s 5d6402f0276f3fd5b022360f84c102449513b154 [39ms]
[2022-07-09T08:41:40.516Z] > git show --textconv :lib/main.dart [45ms]
[2022-07-09T08:42:07.781Z] > git status -z -uall [84ms]
[2022-07-09T08:42:07.896Z] > git symbolic-ref --short HEAD [111ms]
[2022-07-09T08:42:07.939Z] > git ls-files --stage -- C:\Users\JHON MICHEAL\Downloads\grabbitapp-v1.0.9\lib\main.dart [106ms]
[2022-07-09T08:42:07.981Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/main refs/remotes/main [81ms]
[2022-07-09T08:42:08.028Z] > git cat-file -s 5d6402f0276f3fd5b022360f84c102449513b154 [85ms]
[2022-07-09T08:42:08.075Z] > git remote --verbose [86ms]
[2022-07-09T08:42:08.082Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [96ms]
[2022-07-09T08:42:08.178Z] > git config --get commit.template [84ms]
[2022-07-09T08:42:08.329Z] > git show --textconv :lib/main.dart [222ms]
[2022-07-09T08:42:09.080Z] > git ls-files --stage -- C:\Users\JHON MICHEAL\Downloads\grabbitapp-v1.0.9\lib\main.dart [86ms]
[2022-07-09T08:42:09.116Z] > git cat-file -s 5d6402f0276f3fd5b022360f84c102449513b154 [33ms]
[2022-07-09T08:42:09.182Z] > git show --textconv :lib/main.dart [40ms]
[2022-07-09T08:44:39.607Z] > git fetch [101ms]
[2022-07-09T08:44:39.688Z] > git status -z -uall [69ms]
[2022-07-09T08:44:39.732Z] > git symbolic-ref --short HEAD [35ms]
[2022-07-09T08:44:39.774Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/main refs/remotes/main [38ms]
[2022-07-09T08:44:39.842Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [61ms]
[2022-07-09T08:44:39.843Z] > git remote --verbose [58ms]
[2022-07-09T08:44:39.914Z] > git config --get commit.template [40ms]
[2022-07-09T08:44:40.845Z] > git ls-files --stage -- C:\Users\JHON MICHEAL\Downloads\grabbitapp-v1.0.9\lib\main.dart [42ms]
[2022-07-09T08:44:40.894Z] > git cat-file -s 5d6402f0276f3fd5b022360f84c102449513b154 [46ms]
[2022-07-09T08:44:40.950Z] > git show --textconv :lib/main.dart [43ms]
[2022-07-09T08:44:46.970Z] > git -c user.useConfigOnly=true commit --quiet [964ms]
[2022-07-09T08:44:46.970Z] Error: Bad status code: 500
at ClientRequest.<anonymous> (c:\Users\JHON MICHEAL\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\git-editor-main.js:1:470)
at Object.onceWrapper (node:events:510:26)
at ClientRequest.emit (node:events:390:28)
at HTTPParser.parserOnIncomingClient (node:_http_client:623:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
at Socket.socketOnData (node:_http_client:487:22)
at Socket.emit (node:events:390:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
error: There was a problem with the editor '"c:\Users\JHON MICHEAL\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\git-editor.sh"'.
Please supply the message using either -m or -F option.
[2022-07-09T08:44:47.017Z] > git config --get-all user.name [41ms]
[2022-07-09T08:44:47.059Z] > git config --get-all user.email [39ms]
[2022-07-09T08:48:45.145Z] > git fetch [139ms]
[2022-07-09T08:48:45.220Z] > git ls-files --stage -- C:\Users\JHON MICHEAL\Downloads\grabbitapp-v1.0.9\lib\main.dart [76ms]
[2022-07-09T08:48:45.321Z] > git cat-file -s 5d6402f0276f3fd5b022360f84c102449513b154 [97ms]
[2022-07-09T08:48:45.408Z] > git status -z -uall [242ms]
[2022-07-09T08:48:45.463Z] > git show --textconv :lib/main.dart [106ms]
[2022-07-09T08:48:45.496Z] > git symbolic-ref --short HEAD [82ms]
[2022-07-09T08:48:45.545Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/main refs/remotes/main [45ms]
[2022-07-09T08:48:45.613Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [64ms]
[2022-07-09T08:48:45.617Z] > git remote --verbose [64ms]
[2022-07-09T08:48:45.709Z] > git config --get commit.template [76ms]
[2022-07-09T08:48:46.506Z] > git ls-files --stage -- C:\Users\JHON MICHEAL\Downloads\grabbitapp-v1.0.9\lib\main.dart [54ms]
[2022-07-09T08:48:46.546Z] > git cat-file -s 5d6402f0276f3fd5b022360f84c102449513b154 [36ms]
[2022-07-09T08:48:46.618Z] > git show --textconv :lib/main.dart [40ms]
This is shown if the command output is clicked
Go to VSCode's settings and search for git: use editor as commit input.
An option with tick box will appear:
If that option is on just turn it off by unticking it.
You shouldn't leave blank the message before you commit the changes :D
Go to settings and untick the option Git: use editor as commit input:

Github error: failed to push some refs to github.com

I have installed the git ,created repository , then I have tried to push from vs code to github repository with cmd
git push -u origin main
Git say error: failed to push some refs to 'github.com:loobj126/boredape-dapp-bj.git''
What's the problem?
https://github.com/loobj126/boredape-dapp-bj
i ve few approach yet still not resolve
https://komodor.com/learn/how-to-fix-failed-to-push-some-refs-to-git-errors/
Latest input :
after initialize
[2022-04-20T08:44:06.669Z] Validating found git in: C:\Program Files\Git\cmd\git.exe
[2022-04-20T08:44:06.796Z] Using git 2.35.3.windows.1 from C:\Program Files\Git\cmd\git.exe
[2022-04-20T10:45:43.723Z] > git init [128ms]
[2022-04-20T10:45:44.399Z] > git rev-parse --git-dir [72ms]
[2022-04-20T10:45:44.403Z] Open repository: c:\Users\loobj\boredape-dapp-bj
[2022-04-20T10:45:44.606Z] > git fetch [197ms]
[2022-04-20T10:45:44.676Z] > git symbolic-ref --short HEAD [119ms]
[2022-04-20T10:45:44.765Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/master refs/remotes/master [85ms]
[2022-04-20T10:45:44.872Z] > git remote --verbose [99ms]
[2022-04-20T10:45:44.888Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [119ms]
[2022-04-20T10:45:45.019Z] > git config --get commit.template [122ms]
[2022-04-20T10:45:45.040Z] > git config --local branch.master.github-pr-owner-number [121ms]
[2022-04-20T10:45:45.300Z] > git symbolic-ref --short HEAD [101ms]
[2022-04-20T10:45:45.385Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/master refs/remotes/master [80ms]
[2022-04-20T10:45:45.490Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [101ms]
[2022-04-20T10:45:45.507Z] > git remote --verbose [115ms]
[2022-04-20T10:45:45.589Z] > git config --get commit.template [76ms]
Click push
[2022-04-20T10:59:18.763Z] > git push boredape-dapp-bj master [153ms]
[2022-04-20T10:59:18.763Z] error: src refspec master does not match any
error: failed to push some refs to 'https://github.com/loobj126/boredape-dapp-bj.git'
[2022-04-20T11:00:41.028Z] > git fetch [141ms]
[2022-04-20T11:00:41.220Z] > git symbolic-ref --short HEAD [68ms]
[2022-04-20T11:00:41.286Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/master refs/remotes/master [63ms]
[2022-04-20T11:00:41.380Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [91ms]
[2022-04-20T11:00:41.394Z] > git remote --verbose [102ms]
[2022-04-20T11:00:41.485Z] > git config --get commit.template [84ms]
Solution 1: for error: src refspec master does not match any.
All you need to perform is git commit with a proper message and then do git push to the remote origin to avoid any errors.
mkdir repo && cd repo
git remote add origin /path/to/origin.git
git add .
git commit -m "initial commit"
git push origin master
Solution 2 – First, check what refs you have, and once you find that, make a git push to the specific remote branch.
# To get all the ref
git show-ref
# replace with your branch name according to ref
git push origin HEAD:<branch>
this worked for me.
To fix the error, go on and run following commands:
git pull --rebase origin main
git push -u origin main
If the first command above runs successfully, you should get a response that says: Successfully rebased and updated refs/heads/main.
The second command pushes your local repo's current state to the remote branch.
ref: https://www.freecodecamp.org/news/error-failed-to-push-some-refs-to-how-to-fix-in-git/

VSCode "Commit staged" successful but GitHub is not updated

Successfully linked up a repository from GitHub to local, after editing, file model\genre.js needs to be upload and commit back to GitHub. So, I did,
In Source Control panel, in Changed list, click on the "+" sign to make it to staged. File advanced from Changed to Staged.
Same panel, click on ... from the top, then "Commit staged", hit Enter.
This file is gone from Staged list, now only package.json and package-lock.json left in Changed list which is alright as I don't want to touch the masters in GitHub.
Looks perfect. Checking GitHub, oops, shows update was 2 hrs ago, refresh the page, still. Opened up the file and check, not having my latest update.
Is it because I didn't Fork it beforehand? I'm a bit hesitate to git push origin master --force
Here is the Git output from VSCode:
Using git 2.10.2.windows.1 from C:\Program Files\Git\cmd\git.exe
git rev-parse --show-toplevel
git rev-parse --show-toplevel
git status -z -u
git config --get commit.template
git fetch
git symbolic-ref --short HEAD
git rev-parse master
git rev-parse --symbolic-full-name --abbrev-ref master#{u}
git rev-list --left-right master...origin/master
git for-each-ref --format %(refname) %(objectname)
git remote --verbose
git status -z -u
git symbolic-ref --short HEAD
git rev-parse master
git rev-parse --symbolic-full-name --abbrev-ref master#{u}
git rev-list --left-right master...origin/master
git for-each-ref --format %(refname) %(objectname)
git remote --verbose
git show :app.js
git show :populatedb.js
git fetch
git status -z -u
git symbolic-ref --short HEAD
git rev-parse master
git rev-parse --symbolic-full-name --abbrev-ref master#{u}
git rev-list --left-right master...origin/master
git for-each-ref --format %(refname) %(objectname)
git remote --verbose
git show :populatedb.js
git fetch
git show :populatedb.js
git status -z -u
git symbolic-ref --short HEAD
git rev-parse master
git rev-parse --symbolic-full-name --abbrev-ref master#{u}
git rev-list --left-right master...origin/master
git show :populatedb.js
git for-each-ref --format %(refname) %(objectname)
git remote --verbose
git fetch
git show :populatedb.js
git status -z -u
git show :populatedb.js
git symbolic-ref --short HEAD
git rev-parse master
git rev-parse --symbolic-full-name --abbrev-ref master#{u}
git rev-list --left-right master...origin/master
git for-each-ref --format %(refname) %(objectname)
git remote --verbose
git status -z -u
git symbolic-ref --short HEAD
git rev-parse master
git rev-parse --symbolic-full-name --abbrev-ref master#{u}
git rev-list --left-right master...origin/master
git for-each-ref --format %(refname) %(objectname)
git remote --verbose
git status -z -u
git symbolic-ref --short HEAD
git rev-parse master
git rev-parse --symbolic-full-name --abbrev-ref master#{u}
git rev-list --left-right master...origin/master
git for-each-ref --format %(refname) %(objectname)
git remote --verbose
git status -z -u
git symbolic-ref --short HEAD
git rev-parse master
git rev-parse --symbolic-full-name --abbrev-ref master#{u}
git rev-list --left-right master...origin/master
git for-each-ref --format %(refname) %(objectname)
git remote --verbose
git fetch
git status -z -u
git symbolic-ref --short HEAD
git rev-parse master
git rev-parse --symbolic-full-name --abbrev-ref master#{u}
git rev-list --left-right master...origin/master
git for-each-ref --format %(refname) %(objectname)
git remote --verbose
git show :populatedb.js
git show :models/genre.js
git status -z -u
git symbolic-ref --short HEAD
git rev-parse master
git rev-parse --symbolic-full-name --abbrev-ref master#{u}
git rev-list --left-right master...origin/master
git for-each-ref --format %(refname) %(objectname)
git remote --verbose
git fetch
git status -z -u
git symbolic-ref --short HEAD
git rev-parse master
git rev-parse --symbolic-full-name --abbrev-ref master#{u}
git rev-list --left-right master...origin/master
git for-each-ref --format %(refname) %(objectname)
git remote --verbose
git show :models/genre.js
git show HEAD:models/genre.js
git add -A -- c:\Users\Admin\Documents\LEARN\express-locallibrary-tutorial\models\genre.js
git status -z -u
git symbolic-ref --short HEAD
git rev-parse master
git rev-parse --symbolic-full-name --abbrev-ref master#{u}
git rev-list --left-right master...origin/master
git for-each-ref --format %(refname) %(objectname)
git remote --verbose
git show :models/genre.js
git fetch
git status -z -u
git symbolic-ref --short HEAD
git rev-parse master
git rev-parse --symbolic-full-name --abbrev-ref master#{u}
git rev-list --left-right master...origin/master
git for-each-ref --format %(refname) %(objectname)
git remote --verbose
git show :models/genre.js
git commit --quiet --allow-empty-message --file -
git status -z -u
git symbolic-ref --short HEAD
git rev-parse master
git rev-parse --symbolic-full-name --abbrev-ref master#{u}
git rev-list --left-right master...origin/master
git for-each-ref --format %(refname) %(objectname)
git remote --verbose
git show HEAD:models/genre.js
git fetch
git status -z -u
git symbolic-ref --short HEAD
git rev-parse master
git rev-parse --symbolic-full-name --abbrev-ref master#{u}
git rev-list --left-right master...origin/master
git for-each-ref --format %(refname) %(objectname)
git remote --verbose
git show HEAD:models/genre.js
git fetch
git status -z -u
git symbolic-ref --short HEAD
git rev-parse master
git rev-parse --symbolic-full-name --abbrev-ref master#{u}
git rev-list --left-right master...origin/master
git for-each-ref --format %(refname) %(objectname)
git remote --verbose
git show HEAD:models/genre.js
git status -z -u
git symbolic-ref --short HEAD
git rev-parse master
git rev-parse --symbolic-full-name --abbrev-ref master#{u}
git rev-list --left-right master...origin/master
git for-each-ref --format %(refname) %(objectname)
git remote --verbose
git show :models/genre.js
git fetch
git status -z -u
git symbolic-ref --short HEAD
git rev-parse master
git rev-parse --symbolic-full-name --abbrev-ref master#{u}
git rev-list --left-right master...origin/master
git for-each-ref --format %(refname) %(objectname)
git remote --verbose
git show :models/genre.js
git fetch
git status -z -u
git symbolic-ref --short HEAD
git rev-parse master
git rev-parse --symbolic-full-name --abbrev-ref master#{u}
git rev-list --left-right master...origin/master
git for-each-ref --format %(refname) %(objectname)
git remote --verbose
git show :models/genre.js
after vscode commited the changes you need to push it from terminal

sync laravel code with github

I want to sync my code to my github repo, so anytime I update my code it should be updated in the repo. Is there any proper and structured way of doing this.
So this is how I am doing it now
1
$ cd my-project
$ git init
$ git remote add origin GITHUB_URL
$ git pull origin master
$ git status
$ git add .
$ git commit -m "Init repo."
$ git push -u origin master
then just repeat following steps
$ git add .
$ git commit -m "Init repo."
$ git push -u origin master