1077GitHub Desktop not pushing to server?
Increase the http.postBuffer:
git config http.postBuffer 524288000
Increase the http.postBuffer:
git config http.postBuffer 524288000
This is a short, condensed instruction how to set-up command-line access to github.com. Written is response to onboard new FabAcademy students - and get them started with MkDocs.
This guides is for macOS 12 or higher. My Mac uses macOS Ventura 13.0.01.
Go to the .ssh
directory.
$ cd ~/.ssh
Made new key:
$ ssh-keygen -t ed25519 -C "your_email@example.com"
$
, just the ssh-keygen -t ed25519 -C "your_email@example.com"
part. But with your email.You can name your key. For this example, we call it id_github_test
.
$ eval "$(ssh-agent -s)"
Open .ssh/config
in your favourite text editor. If you want to stay at the command line, use nano.
Add the following:
Host *.github.com
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_github_test
Adding private key to ssh-agent
$ ssh-add --apple-use-keychain ~/.ssh/id_github_test
This add the new key to the Apple Keychain.
If you used a passphrase when you created the key, you will be asked for it now.
Enter passphrase for /Users/georg/.ssh/id_github_test:
Identity added: /Users/georg/.ssh/id_github_test (your_email@example.com)
Copy and paster your public key, in this example case, id_github_test.pub.
The tutorial on Github suggest to copy the public key using a command:
$ pbcopy < ~/.ssh/id_github_test.pub
pbcopy
- for paste board copy is the terminal interface to the macOS' Copy & Paste. pbcopy <
read the content of a file into the copy memory. After running pbcopy
you can press Command-V to paste the text.
I setup Two-Factor Authentication at GitHub.com, I had to confirm the addition of a new key via my mobile GitHub App. Your mileage might vary.
$ ssh -T git@github.com
Hi trembl! You've successfully authenticated,
but GitHub does not provide shell access.
Sources:
Quick run through hugo Installation & Update on macOS.
brew install hugo
hugo version
hugo v0.109.0+extended darwin/amd64 BuildDate=unknown
brew upgrade hugo
Warning: hugo 0.109.0 already installed
hugo new site my-new-hugo-site
cd my-new-hugo-site
git init
git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke themes/ananke
echo "theme = 'ananke'" >> config.toml
hugo does not come with an in-built theme, therefore we need to clone the anake theme into themes/ananke. More hugo themes. Clone and update config.toml.
hugo server
Just hugo, nothing else.
hugo
Start building sites …
hugo v0.109.0+extended darwin/amd64 BuildDate=unknown
INFO 2022/12/26 19:37:15 syncing static files to /
| EN
-------------------+-----
Pages | 10
Paginator pages | 0
Non-page files | 0
Static files | 1
Processed images | 0
Aliases | 1
Sitemaps | 1
Cleaned | 0
Total in 154 ms
Quick run through mkDocs Installation & Update on macOS.
pip install mkdocs
mkdocs -V
mkdocs, version 1.1.2 from /usr/local/lib/python3.9/site-packages/mkdocs (Python 3.9)
pip install -U mkdocs
mkdocs -V
mkdocs, version 1.4.2 from /usr/local/lib/python3.9/site-packages/mkdocs (Python 3.9)
pip install mkdocs-material
pip install -U mkdocs-material
mkdocs new my-new-site
cd my-new-site
mkdocs serve
⌨️: ^[ctrl]-C
Renaming a branch on Github is straight-forward:
The "Lean More" link has some instructions how to update the local environments:
Your members will have to manually update their local environments. We'll let them know when they visit the repository, or you can share the following commands.
git branch -m oldbranchname newbranchname
git fetch origin
Username for 'https://github.com': trembl
Password for 'https://trembl@github.com':
I tried automatically to log-in with my GitHub Password.
remote: Support for password authentication was removed on
August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-
authentication-requirements-for-git-operations/ for more information.
https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/
Ok, we need a Personal Access Token instead of the password!
Go to github.com > Settings > Developer Settings > Personal access tokens, and generate a new token with full repo access.
Once we use the token instead of the password, it works.
git branch -u origin/main main
# Branch 'main' set up to track remote branch 'main' from 'origin'.
git remote set-head origin -a
# origin/HEAD set to main
git reset --hard origin/main
main
is the name your main
branch.
When using git with a key that has a passphrase, you are asked the passphrase every time you pull/push. To make this a bit more convenient, add the key to the OSX Keychain.
Store key in OSX Keychain:
ssh-add -K ~/.ssh/my_key
Open .ssh/config
Host *
UseKeychain yes
AddKeysToAgent yes
IdentityFile ~/.ssh/my_key
Update from 864 Pulling a GitHub Repository with Tokens & Webhooks
GitLab requries a gitlab-ci-token: prefix:
$token = 'gitlab-ci-token:abcdefghijklmopq'
git pull
does not overwrite any local changed files by default. If you want to overwrite - and loose - any local changes, use:
git reset --hard origin/main
origin/main
might be origin/master
for legacy repos.
Here is how to sync a Wordpress Theme from Github to your own server:
Create a Personal Access Token on GitHub
https://www.trembl.org/update-my-website.php
https://username:passwd@www.trembl.org/update-my-website.php
Go to your tmp directory, init the git repo and pull the repo
cd /my/local/tmp/directory/
git init // initialize git
git reset --hard
git pull https://{$token}@github.com/{$repo}
The update-my-website.php
should look something like this:
<?php
// path to local tmp directory
$temp_dir = '/my/local/tmp/directory/';
// path to local theme directory
$theme_dir = "/my/local/theme/directory/";
// access token from GitHub
$token = 'abcdefghijk';
// Repo
$repo = 'github.com/trembl/SuperNiceRepo.git';
// - - - - -
// change to local git directory
chdir($temp_dir);
// resets local git
exec('git reset --hard 2>&1') . ", ";
// get latest from github & store it in $msg
echo exec("git pull https://<span style="background:red">$token</span>@$repo 2>&1");
$msg = exec("git pull https://$token@$repo 2>&1");
if ($msg != "Already up to date.") {
// Only copy if the git repo actually changed
// delete theme dir
echo "\n\nDeleting Theme Directory.\n";
echo exec("rm -rf $theme_dir*"); // * deletes all files within the directory
// Copying Theme from $temp_dir to $theme_dir
echo "\n\nCopying Theme from tmp folder to wp-content.\n";
echo exec("cp -a $temp_dir/* $theme_dir");
// cp -a $temp_dir/* copies everything _except_ invisible files, like .git
} else {
echo($msg);
}
?>
update-my-website.php
protected by .htaccess?
860 Access a URL behind htaccess/htpasswd
Protect update.php ONLY with .htaccess?
940 Protecting a Single File with .htaccess
I get the following error message: Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)/
That means git is not initalized. Run git init