Scheduled Git Auto-commit: Showing I’m not lazy on my GitHub profile
Hoću da imam script koji će moj notes automatski push-ovati na svakih 10 minuta bez moje intervencije.
|
|
And call it from crontab -e
|
|
Idea was from How to automate your git workflow on windows | by Ilesanmi Temitope | Medium
Prijavljivao mi je grešku:
fatal: could not read Username for 'https://github.com': Device not configured
čim pokrenem script-e iz crontab.
System is not finding the credentials, pa sam probao sa setovanjem HOME varijable, i nije,
Furthermore, you have the option to write the cron task in the specified format (execute crontab -e and insert the following cronjob).
-
-
-
-
- /bin/bash -l -c ‘cd /var/www/project && ./autogit-project.sh » /home/cron_log.log 2>&1’
-
-
-
You can examine the cron jobs of the intended user responsible for
BackwardJet/Cron-Auto-Push: A script to automate pushing to Github
U repo folderu moraš pokrenuti:
|
|
https://askubuntu.com/a/814235
Eh. [Git + mac]: Schedule your git commands with launchd | { Ellis Min } I odličan je ovaj tool, baš odličan: Launched - A Plist Generator
Problem: Keychain access in crontab
git config credential.helper
result: osxkeychain
Once installed, just tell Git to use the KeyChain to store your credentials:
git config –global credential.helper osxkeychain
Next time you clone a repo via HTTPS, you’ll be prompt for granting access to KeyChain. That’s it.
Suština je da crontab ne vidi keychain, ali hoće da interact with the “System roots” keychain unless you specify a keychain as I’ve done in my crontab, tako da sam pokušao
Git’s built-in credential helpers (Windows: wincred, macOS: osxkeychain, Linux: gnome-keyring/libsecret)
Međutim, imao sam grešku u crontab-u, pa sam morao da prebacim na unencrypted plaintext storovanje u fajlu: GitHub Commit Bot to Stack Your Contributions Graph - blog.karenying.com
|
|
I onda je proradilo, ali to nije baš idealno rešenje.
I dalje tražim rešenje da zadržim keychain kao mesto za password-e:
|
|
Takođe, sa lakoćom radi with the mac launchd
with no password prompt and also Apple says that better way is to use launchd instead of cron
Copy the github.com passwords to the system keychain.
Probaj da pokreneš u CLI security list-keychains
gde dobijaš i “login.keychain-db” i “System.keychain”, a zatim u crontab
*/1 * * * * security list-keychains -d user
i videćeš da user keychain nije čitan iz crontab-a, jer dobijaš samo “/Library/Keychains/System.keychain”
Pokreni alat Keychain Access, zatim uradi search za “github.com”, zatim desni click i “Copy”, zatim opy that service and password from login.keychians to syste,.keychains as cronjob by default looks into system keychains and not login keychains. This worked for me.
How to access Keychain of my user from cron? - Ask Different
Pokušao sam i ovo, ali to ima veze samo sa SSH:
|
|
Battling with SSH, cron jobs, and macOS Keyring · Nicola Iarocci
Obrati pažnju da ima find-generic-password
i find-internet-password
|
|
kako bi bilo da dodam keychain u search list?
Ovako:
Cron would only load from the system keychain, so the password has to be there.