====== GIT Related Issues ====== ===== Git Bash ===== * Git Bash reference for Windows - https://www.codeproject.com/Articles/457305/Basic-Git-Command-Line-Reference-for-Windows-Users * Running .sh scripts in Git Bash - https://stackoverflow.com/questions/36401147/running-sh-scripts-in-git-bash ===== Git Basics ===== * Basic GIT examples - https://dzone.com/articles/top-20-git-commands-with-examples * Where to find system, global and local Git config files on Windows and Ubuntu Linux - [[https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/Where-system-global-and-local-Windows-Git-config-files-are-saved|link]] * Good - Beanstalk guide to working with git on windows - http://guides.beanstalkapp.com/version-control/git-on-windows.html * Git clone over ssh, push over https - https://stackoverflow.com/questions/30869912/git-clone-over-ssh-push-over-https * Git to send output to a file - have to redirect stderr! - https://askubuntu.com/questions/989015/how-to-get-git-producing-output-to-a-file * How do I view all GIT settings? * Run git config --list , showing system, global, and (if inside a repository) local configs. * Run git config --list --show-origin , also shows the origin file of each config item. ----- * https://superuser.com/questions/1220479/git-clone-ssh-identity-file-not-accessible * * Query: windows commandline git specify keys * How to tell git which private key to use: https://superuser.com/questions/232373/how-to-tell-git-which-private-key-to-use * Which private key to use with ah shell command - https://stackoverflow.com/questions/4565700/how-to-specify-the-private-ssh-key-to-use-when-executing-shell-command-on-git * How to list keys added to ssh-agent with ssh-add? https://unix.stackexchange.com/questions/58969/how-to-list-keys-added-to-ssh-agent-with-ssh-add * How does git know which ssh key to use for its operations? - https://stackoverflow.com/questions/37518346/how-does-git-know-which-ssh-key-to-use-for-its-operations ===== Backup script using GIT works fine except when run from scheduled tasks ===== Overall task: Trying to merge information from one repository into another, then periodically backup the latest combined information to another repository. This running on Plesk Obsidian with Windows server. Problem: The script works great when run from a Remote Desktop login as administrator. But the script hangs when run from a Plesk scheduled task, it hangs at the first GIT pull statement. It then hangs at some other points to. First problem: The batch file didnt run at all as a scheduled task. Putting the batch in Administrator/Documents seemed to solve this issue * Is it the chroot issue mentioned here? https://docs.plesk.com/en-US/obsidian/administrator-guide/website-management/scheduling-tasks.65207/ * Or maybe this answer: https://stackoverflow.com/questions/41030190/command-to-run-a-bat-file * Some progress creating c:\users\administrators\documents\dailyrun.bat - plesk can execute this rem This will work from a plesk fired batchfile. But it requires a dummy repo to be created, and the clone command to run from there git init git config --global core.sshCommand "ssh -i c:\\users\\administrator\\.ssh\\id_rsa -F /dev/null" git clone https://github.com/garnetr/thegarnetnet * SSH Fails from crontab but succeeds when executed from a command line - https://stackoverflow.com/questions/869589/why-ssh-fails-from-crontab-but-succedes-when-executed-from-a-command-line * SSH agent and Crontab, how to get them to work together https://stackoverflow.com/questions/2205282/ssh-agent-and-crontab-is-there-a-good-way-to-get-these-to-meet * How to use github deploy keys - https://gist.github.com/zhujunsan/a0becf82ade50ed06115 * Queries * [[https://www.google.com/search?q=running+git+from+background+doesnt+work&oq=running+git+from+background+doesnt+work&aqs=chrome..69i57j33.7311j0j7&sourceid=chrome&ie=UTF-8|running git from background doesnt work]] * * Articles about GIT specifically * Adding remotes to GIT - https://git-scm.com/book/it/v2/Git-Basics-Working-with-Remotes * How to tell GIT which private key to use - [[https://superuser.com/questions/232373/how-to-tell-git-which-private-key-to-use|link]] * ~/.ssh/config can list hosts and which identify file and users to use - example GITHUB * Query windows git credential.helper hang [[https://www.google.com/search?q=windows+git+credential.helper+hang&oq=windows+git+credential.helper+hang&aqs=chrome..69i57j33.11090j0j7&sourceid=chrome&ie=UTF-8|link]] * Exactly the problem I am seeing, but no solution - Git password manager hangs on Git Pull - https://github.com/microsoft/Git-Credential-Manager-for-Windows/issues/405 * Unable to run GIT commands with crontab - https://stackoverflow.com/questions/55966634/unable-to-run-git-commands-with-crontab * Why ssh fails from crontab but succedes when executed from a command line? - https://stackoverflow.com/questions/869589/why-ssh-fails-from-crontab-but-succedes-when-executed-from-a-command-line * Query: git fails from crontab but succedes when executed from a command line * Query: git hangs when run from background script * Query: openssh the system cannot find the path specified site:stackoverflow.com * When run from Plesk Administrator, this problem happens: sshkeygen can not find the path specified - https://stackoverflow.com/questions/32390778/ssh-keygen-the-system-cannot-find-the-path-specified * This is more info on this problem that plesk administrator can't find things that clearly seem to be part of the path spec it is using. Giving extra folder rights did not solve the problem. This talks about the difference between 32 and 64 bit programs and how they are run * What is the reason for the error message “System cannot find the path specified”? https://stackoverflow.com/questions/33638281/what-is-the-reason-for-the-error-message-system-cannot-find-the-path-specified * Some notes on executing batcj files as scheduled tasks: https://stackoverflow.com/questions/41811209/what-must-be-taken-into-account-on-executing-a-batch-file-as-scheduled-task/41821620#41821620 Look closer at this: It talks about disabling the git-credential-manager: * git pull over ssh in Windows client hangs after starting to use a token - [[https://stackoverflow.com/questions/52740141/git-pull-over-ssh-in-windows-client-hangs-after-starting-to-use-a-token|link]] * SSH-Agent and Crontab - get them to work together - https://stackoverflow.com/questions/2205282/ssh-agent-and-crontab-is-there-a-good-way-to-get-these-to-meet * Query: script fails when run from background user ssh keys * Query: running git from background doesnt work. [[https://www.google.com/search?q=running+git+from+background+doesnt+work&oq=running+git+from+background+doesnt+work&aqs=chrome..69i57j33.7311j0j7&sourceid=chrome&ie=UTF-8|link]] * SSH git key management - https://tarranjones.com/2017/02/17/ssh-git-key-management/ * Query: configure core.sshcommand globally * https://stackoverflow.com/questions/31475646/using-git-ssh-command-in-git-for-windows/38474220#38474220 ====== Things other than GIT ====== * Problems with paths in windows - https://stackoverflow.com/questions/57434750/system-cannot-find-path-even-though-it-exists-in-paths * Current user in a windows environment - https://stackoverflow.com/questions/1607271/how-do-you-find-the-current-user-in-a-windows-environment