Getting the last commit hash from a remote repo without cloning

$ git ls-remote https://github.com/gturri/dokuJClient.git 2fb540fc8c7e9116791638393370a2fa0f079737 HEAD 2fb540fc8c7e9116791638393370a2fa0f079737 refs/heads/master This command can be run from any directory. If you only want the last sha1, eg to use it in a script, you could then do: git ls-remote https://github.com/gturri/dokuJClient.git HEAD | awk ‘{ print $1}’

Git rm several files?

You can give wildcards to git rm. e.g. git rm *.c Or you can just write down the names of all the files in another file, say filesToRemove.txt: path/to/file.c path/to/another/file2.c path/to/some/other/file3.c You can automate this: find . -name ‘*.c’ > filesToRemove.txt Open the file and review the names (to make sure it’s alright). Then: cat … Read more

To use on Visual Studio Code, but show “Could not read from remote repository.”

I thought the answer by @codewizard was the correct one. Seems VS Code uses ‘id_rsa.pub’ key only, it was not using my other ssh key pair that git.exe was configured to use.(This key wasn’t name id_rsa.) However after generating a new id_rsa key pair, I still got permission denied (publickey). I Found my answer on … Read more

Concept of git tracking and git staging

Git essentially has 4 main statuses for the files in your local repo: untracked: The file is new, Git knows nothing about it. If you git add <file>, it becomes: staged: Now Git knows the file (tracked), but also made it part of the next commit batch (called the index). If you git commit, it … Read more

GIT over SSH in Ansible hangs, eventhough ssh-agent forwarding is set up

Just to expand on tillda’s answer, that config can be placed in an ansible.cfg file alongside your playbook. e.g.: ansible.cfg [defaults] transport = ssh [ssh_connection] ssh_args = -o ForwardAgent=yes I’d say it’s better to do that than setting as an env variable, as placing it in a conf file is both more declarative and also … Read more

git request-pull: how to create a (github) pull request on the command line?

Even though they are called exactly the same thing, a GitHub pull request and a ‘git request-pull’ are completely different. The git request-pull is for generating a summary of pending changes to be sent to a mailing list. It has no integration by default with GitHub. The GitHub Pull Requests is a fully featured function … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)