date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,428,000,262,000
I am using git to version control config files on my system. I have git root at the root of my filesystem /, and I control /etc and /root. When I am in /root and do: git log .zshrc, it shows me commit history. I want to display the contents of .zshrc for particular commit: # git show a100e3515779a900509b52230d449a6446...
In <rev>:<path> notation, the path is relative to the tree-ish object itself, not to the current directory, unless it starts with ./ or ../. In both cases absolute paths (…:/…) aren’t supported, only relative paths. git show a100e3515779a900509b52230d449a6446fa110b:.zshrc means “find the a100e3515779a900509b52230d449...
git show does not understand relative file names
1,428,000,262,000
From May 30, 2022: Google no longer supports the use of third-party apps or devices which ask you to sign in to your Google Account using only your username and password. This is a problem for various applications including git send-email. sendgmail is tool from Google written in go which allows to use OAuth2 creden...
Setup the Workspace by following these steps. Enable the Gmail API on the project. Setup the OAuth Consent Page. I'm not sure if you can get past not having an authorized domain. I included one I own (and use for a different Google OAuth workflow) Ensure the Gmail API ../auth/gmail.send scope is allowed, nothing else...
gmail sendgmail configuration for git send-email
1,428,000,262,000
I build openwrt firmware and I just used a pr (patch kernel update) with patch -p1 < filename.patch and I want to remove to reapply a new one, what would be the best? thank you
You can revert the patch: patch -R -p1 < filename.patch
removing last patching kernel
1,428,000,262,000
I have this ~/.gitconfig alias: b = "!r() { count=10; git for-each-ref --sort=-committerdate refs/heads --format='%(HEAD)%(color:bold green)%(committerdate:relative)|%(color:yellow)%(refname:short)|%(color:red)%(objectname:short)%(color:reset)|%(color:blue)%(subject)|%(color:magenta)%(authorname)%(color:reset)' --colo...
If you don't have access to a column implementation that understands output width limitation, one way would be to implement the "column-building" algorithm in awk. However, implementing the logic - while straighforward - adds quite a bit to the length of your gitconfig function: awk -F'|' -v maxw=4 '{for (i=1;i<=NF;i+...
How to limit git branch --format string length
1,428,000,262,000
I am new to linux, and I have just installed git using, sudo apt-get install git-all When I attempted to restore a file after making modifications, I get the following error: git: 'restore' is not a git command. See 'git --help'. I did some research, and it turns out that git restore was not implemented until git ver...
You can download the latest version here: https://git-scm.com/download/linux URL: https://www.kernel.org/pub/software/scm/git/git-2.34.1.tar.gz then make it.
Git is not updating [duplicate]
1,428,000,262,000
Let's suppose the following scenario, two Linux computers A and B are connected through an special hardware radio link, which is not always available. This might be the case with two Raspberry Pi. None of the computers have access to the internet. Linux A has a library called libabc.so with a size of 1GB and Linux B h...
As far as I understand rsync will synchronize the whole file as well. It will synchronize the file. But the default behavior (for network transfers) is not to send the entire data if the file already exists, but to calculate and compare rolling block checksums. This reduces the data that has to be sent if there is...
Update a library file with just the changes in the new file
1,428,000,262,000
I'm using git-annex in version 7.20190129 as it is provided on my Debian Stable (Buster) machine to keep big files under version control and have them distributed over multiple machines and drives. This works well as long as I have at least one "real" git-annex repository (not a special remote). What I'd be intereste...
A special remote is just storing the file data, not the git repository. Think of it as a a library's cellar: A library may build an additional room to store its books there, but if you want to build a library back from the cellar, you don't have any index, don't know which book is in which catalogue, and you don't hav...
accessing git-annex special remote from new repository
1,428,000,262,000
I'm running git fsck command on some repositories, and for 4 of them I got the same error: error in tree b2b510c83ea553c587ebe5bc160e92cb7888393a: duplicateEntries: contains duplicate file entries error in tree b3969ac6fe6b6359d48006e6a4cf3ffd5a4350a3: duplicateEntries: contains duplicate file entries error in tree 5a...
Git stores the contents of a directory in a tree object. In general, tree objects are supposed to be in sorted filename order by byte value. This message means that those particular tree objects contain a duplicate entry, which isn't supposed to be the case. Whatever tool you're using to create these objects has cre...
git fsck fails with the same error for 4 different repositories
1,428,000,262,000
If I run a command in a subshell, I can collect the stdout into a variable, such as: var=$(echo 'hello world') echo $var Will print 'hello world' as expected. If I add colour and a new line, this too is ok: var=$(echo "Text in \n\e[34mBlue") echo -e $var Prints "Text in Blue" with the word 'Blue' coloured and on the...
The default value of git's color.ui configuration is auto, which only uses colours when output is to a TTY. You can change that in your configuration to always to have the output be coloured regardless. Most usefully for your use case, there is a -c option to git that allows overriding a configuration value just for t...
Capture git output into variable
1,428,000,262,000
I have found a strange error. It is OK when I commit using gpg with git under bash or zsh. git commit -S -m "xxx" However when I commit it under tmux, I got: gpg: signing failed: Operation cancelled gpg: signing failed: Operation cancelled error: gpg failed to sign the data fatal: failed to write commit object
You need to ensure that your GPG_TTY variable is correct; add GPG_TTY=$(tty) export GPG_TTY to your shell startup scripts, including for non-login shells (your login shells are probably OK, but not non-login shells, which is why this fails in tmux).
gpg: signing failed: Operation cancelled under tmux?
1,428,000,262,000
I have a weird issue that I can't seem to find an answer for. When I enter: git config --global http.proxy http://{username}:{password}@{proxy address}:{port}/ It returns an error: git config --global http.proxy http://{username}:mount /dev/cdrom /media/cdrom{password}@{proxy address}:{port}/ I do have an !1 in the pa...
Yes, in an interactive shell, ! is the last command line, and it's quite possible !1 is the first word of it, etc. (Can you tell it's not a feature I use?) Just put the whole proxy url in single quotes like git config --global http.proxy 'http://{username}:{password}@{proxy address}:{port}/' (You'll see similar effec...
Proxy address is being replaced with /dev/cdrom
1,428,000,262,000
In my .bash_profile I have a parse_git_branch function from the internet, and a PS1 to color some of my output. If possible, I would like to make my git branch name colored red, instead of white. I tired changing a few variables, but with no luck. I would like (master) to be red, if possible.
I was able to get the git branch to print out in red by changing export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[93m\]\w\[\033[m\]\$(parse_git_branch)\[\033[00m\] \n$ " to export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[93m\]\w\[\033[31m\]\$(parse_git_branch)\[\033[00m\] \n$ " To highlight the...
Changing the color of git branch output?
1,428,000,262,000
I created a list by using $ git stash show --name-only | grep -i "Kopie" Output: A - Kopie.txt B - Kopie.txt How can I unstash all the files from the list? First Approach: $ git stash show --name-only | grep -i "Kopie" | xargs git checkout stash@{0} -- Result: error: pathspec 'A' did not match any file(s) known ...
You are not quoting the filenames when they are passed to git checkout, so A, - & Kopie.txt are being treated as different files. Try adding the -I {} option to xargs, then put quotes around {}: git stash show --name-only | grep -i "Kopie" | xargs -I {} git checkout stash@{0} -- "{}"
Git unstash all files from list
1,428,000,262,000
Is there a straightforward way to display the results of my PS1 for a given set of directories? To avoid the XY Problem, I'll state up front: I want to rapidly check the status of every git repo within a directory. I can run git status in a for ... do ... done loop, but that is hard to read. I have oh-my-git running b...
for rep in */; do printf '%s:\t' "$rep" ( cd "$rep" && git status --short --branch --untracked-files=no ) done or, using short options, for rep in */; do printf '%s:\t' "$rep" ( cd "$rep" && git status -sbuno ) done This changes into each directory in the current directory and runs the given git stat...
Display command prompt (PS1) info for a set of directories
1,428,000,262,000
I have several Git repositories containing a file mergedriver.info This file looks always like this: <project name> <repository name> A script, triggered by a Git merge driver, is evaluating this file: mergedriverinfo="$(git cat-file -p HEAD:mergedriver.info)" success=$? if [[ "$success" == "0" ]]; then log "Eval...
You need to realize that the sed regex [^\s] will not do what you think it should, viz. hunt for a non-whitepspace, rather it shall negate two characters, a backslash \ and the letter s. What is needed is the \S which is meant specifically for this. And to manage the output of mergerdriver.info command spilling over m...
Extracting parts of whitespace separated string
1,497,883,180,000
I have a Drupal 8 installation in a directory called my-D8. I want to update it to drupal 8.3.1, and I've downloaded drupal-8.3.1.tar.gz. I have both in my sites directory: /d/sites $ ls drupal-8.3.1.tar.gz my-d8/ When I try to extract the archive, it puts everything in a directory called drupal-8.3.1, which I expec...
From the manual: -C DIR change to directory DIR This alters the working directory of the tar process. You can also use --strip to remove the first component of the filenames (e. g. drupal-8.3.1/) in the archive. So, you can: tar --strip=1 -zx -f drupal-8.3.1.tar.gz -C my-d8 If your tar doesn't have --strip...
extract tar archive to existing directory in git-bash
1,497,883,180,000
I'm wondering what the name of the default git mergetool on my linux server is?
The screenshot provided appears to be vimdiff.
What is the name of the default git mergetool?
1,497,883,180,000
I cloned a repo (using fictious examples here) $ git clone http://someplace.somedomain.name/resource.git went to the directory $ cd resource and then tried to edit a file within the resource directory /home/shirish/resource $ editor somefile.txt Now I am not familiar with what editor is being used by git and if i...
In Debian, the editor command is an alternative: sudo update-alternatives --config editor It's not managed by git. When a git commands needs an editor (e.g. for a commit message), it uses the editor given by the GIT_EDITOR environment variable, or failing that, the editor specified by the core.editor variable. See gi...
where is the 'Editor' variable kept in git?
1,497,883,180,000
I have two branches, which contain a file that has recently been added to git ignore. It is an auto-generated file. I removed it in the master branch from the cache using git rm --cached fileName. However, i still get the message that he file would be overwritten when I try to change to the second branch using git che...
Commit your current changes and remove fileName.
Git - Remove file from two branches
1,497,883,180,000
I keep my dotfiles in a private git repo on bitbucket and this works great for the majority of my files (.vimrc, .tmux.conf etc) then I just set up symlinks from my home directory to my cloned gitrepo of dotfiles and everything works great. My problem is that I also use the prezto framework to manage zsh plugins. Pre...
You can use a hardlink in this instance, presuming you are not crossing file system boundaries. In case you are unaware, a hardlink is much like a symlink, but from a process perspective the file is a normal file. This includes git, which will properly work with them and archive them as normal files with content and...
Git tracking dotfiles that are symlinked
1,497,883,180,000
I want to download a portion of this diff: https://gist.github.com/sergeykish/650839#file-dvorak-de-diff. Pseudocode git pull https://gist.github.com/sergeykish/650839#file-dvorak-de-diff.patch
git pull is used for updating existing repository. If you want to download the content of the new repository, there is git clone command: $ git clone https://gist.github.com/sergeykish/650839 Cloning into '650839'... remote: Counting objects: 15, done. remote: Total 15 (delta 0), reused 0 (delta 0), pack-reused 15 Un...
Why you cannot `git pull SHA...650839#file-diff.pach`?
1,497,883,180,000
Consider a Git log: commit 4d6b30238fbfc972ea4505cadf43abd316506d9e Author: Dotan Cohen <[email protected]> Date: Mon Jan 11 22:41:21 2016 +0200 Final foobar version commit 4d6b30238fbfc972ea4505cadf43abd316506d9e Author: Dotan Cohen <[email protected]> Date: Mon Jan 11 19:11:51 2016 +0200 Working fooba...
The following Perl code should get you very, very close to what I think you want. If you're not familiar with Perl, you'll need to install the DateTime::Format::Strptime module from CPAN... cpan install DateTime::Format::Strptime. Then, output your git log to a file git log > git.log. After that, paste the following c...
Estimate time spent on Git project with grep
1,497,883,180,000
I am running TCSH and I would like to update my prompt every time I run a command. I think can currently do that via backticks. set tmpstr = `git status --untracked-files=no --porcelain` set prompt="%{\e[35;1m%} $tmpstr %{\e[32;1m%}%n%{\e[37m%}@%{\e[33m%}%m%{\e[37m%}:%{\e[36m%}%~%{\e[37m%}"\$"%{\e[0m%} " But I re...
I ended up using precmd I put alias precmd 'source ~/.tcsh/precmd.tcsh' into my .cshrc file and moved my prompt set into that file. Source of the .tcsh set tmpstr = `(git status --untracked-files=no --porcelain >! ~/out ) >&! ~/out1` #echo $tmpstr #for debugging if !( -s ~/out ) then if !( -s ~/out1 ) t...
Updating a git variable in the Shell prompt on every command
1,497,883,180,000
I've seen some tutorials on the internet in which people are using etckeeper to keep a log of their server configuration, and yet they use the git command directly instead of running it through the etckeeper vcs command. This seems a little dangerous to me, since etckeeper is a proxy for the git command since etckee...
etckeeper vcs merely loads /etc/etckeeper/etckeeper.conf (which may, but usually doesn't set environment variables), determines which VCS system the repository uses, and calls the appropriate VCS command with the specified argument. If you know that the repository is stored under git, running etckeeper vcs foo or git ...
Is it always necessary to run etckeeper git commands using the vcs command?
1,497,883,180,000
I have installed java 8 on my bluehost VPS. I have followed http://tecadmin.net/install-java-8-on-centos-rhel-and-fedora/ instructions . In order to add directories to PATH variable I have added PATH=$PATH:/opt/jdk1.8.0_45/bin:/opt/jdk1.8.0_45/jre/bin JAVA_HOME=/opt/jdk1.8.0_45 JRE_HOME=/opt/jdk1.8.0_45/jre to etc/...
You can't use variable expansion in /etc/environment (which is why you see an unexpanded $PATH in the output from echo $PATH). /etc/environment is read by the pam_env module not a shell script so just simple assignments. You probably want to add this stuff to /etc/profile or add a file under /etc/profile.d/. See https...
Can't push git updates & run Unix commands when connecting via SSH
1,497,883,180,000
I'm currently using RedHat Enterprise 6. Git had issues cloning Github repos using HTTPS. After some investigation (e.g. enabling GIT_CURL_VERBOSE and GIT_TRACE) the problem was narrowed to a certificate validation issue, which was solved updating the certificate DB, i.e.: curl http://curl.haxx.se/ca/cacert.pem -o /et...
I believe you can override the .crt file that git uses like this: $ git config --system http.sslcainfo "/etc/pki/tls/certs/ca-bundle.crt" You can disable SSL checks all together (not recommended): $ git config --system http.sslverify false
How can I add an x509 certificates bundle (ca-bundle.crt) to NSS database (~./pki/nssdb)
1,497,883,180,000
I need a PHP script to perform git pull however I am not naive enough to give it permissions on git. I've wrapped git pull in a script which www-data has permissions for, but I'm not sure how to give the script permissions on git itself: $ sudo tail -n1 /etc/sudoers www-data ALL=(ALL) NOPASSWD: /home/php-scripts/git-p...
Your script runs under www-data:www-data I suppose. You have to run the git pull with a user that have a write permission on your cloned repository. You have configured sudo, but you don't call it anywhere which doesn't make much sense (not saying you need to do that at all). Verify under what user you are running and...
Allow www-data to perform specific commands
1,497,883,180,000
My terminal has output like the one below. pc@pop-os:~/my-project (main)$ This project was downloaded via GitHub. (main) is colored green. I set it as a branch name that appears on my terminal when I go to the project's directory. When I make a change, I want the terminal to recognize the change and change the (main) ...
I used the parseGitBranch function to define the colors. Your function should look like this: parseGitBranch () { if ! git rev-parse --git-dir &> /dev/null; then return fi branch="($(git branch --show-current))" local STATUS STATUS=$(git status --porcelain) if [ -n "$STATUS" ]; then ec...
How can I change terminal branch color?
1,497,883,180,000
I had a git repo on machine A. I did an rsync from machine A to machine B using the flags rsync -zvaP /media/shihab/development shihab@remote:/media/shihab/OSDisk/development Later I did some changes in machine B and did an rsync from machine B to machine A using the same flags: rsync -zvaP shihab@remote:/media/shih...
You say that rsync "is overwriting a file with a newer timestamp with that on machine B with an older time-stamp". The two files are different so the destination will be updated to match the source. That's what rsync does. If you want rsync only to update files when the source is newer than the destination you needed ...
Rsync not considering timestamps while syncronising git repos after permissions changed
1,497,883,180,000
I have a git hook (post-receive) to update the documentation, run the unit-tests etc. etc., but the thing is sometimes not working. Here are the contents of the post-receive hook: #!/usr/bin/bash ~/bubblegum_ci > /tmp/bubblegum_ci_log 2>&1 & That's not hard to understand, just launch a script in the background and pi...
The problem was to do with environment variables. The clue here was the fact it worked on the command line and not in whatever environment gets spun up by whatever runs the git hook. So I put the env command in the script, and noticed GIT_DIR=".". This explains the cryptic error message fatal: not a git repository: '....
Why is this path only sometimes not a git repository?
1,497,883,180,000
I have a zsh alias: gitbs() { git branch | grep -- $1 } And I would like to pass the result into git checkout, for example: git checkout | gitbs state How can I make this work?
A shell pipe passes the output of a command to the input of another command. This won't help you here: you want to pass the output of a command as a command line argument of another command. The tool for that is command substitution. So the basic idea is git checkout "$(gitbs state)" (It's still a pipe under the hood...
How to pass zsh alias function to pipe
1,497,883,180,000
I am trying to execute a script that pushes to git every x minutes as a service, but git uses 100% CPU and high amounts of RAM while seemingly doing nothing. (I checked after 8 minutes and it was still going) When I execute the script manually it works perfectly and takes only a few seconds. backupToGit.sh: #!/bin/bas...
I think I just found the Solution myself with the Help of @OlivierDulac : The Service was only setup to start the script which would run in an endless loop, but never to stop the script. this probably resulted in the script running one more time for every time I started / restarted the Service leading to an overlap in...
I am trying to execute a script that pushes to git every x minutes as a service, but git uses 100% CPU and high amounts of RAM
1,497,883,180,000
A little background- I recently upgraded my headless Ubuntu Server 18.04 install to 20.04. In that process, webmin somehow was gone from my system. The repository was disabled. So I re-enabled, then re-installed. Most everything was where I wanted it to be (SMB server config) and basically only my menu customizations ...
That helped me out! I couldn't figure out how to download that as a patch, but the file it is referencing on my system was under /usr/share/webmin/proc/. There I backed up linux.lib.pl then edited it in nano. There I changed the lines noted in the patch (+ for add, - for take away), saved, and it worked. Otherwise...
Webmin not showing running processes after upgrade to Ubuntu Server 20.04 from 18.04
1,497,883,180,000
Brief: I would like to restrict port-forwarding from an SSH user identified by password. Explanation: In the following explanation of how to install a git server: https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server They explain that an SSH user with limited or no shell access could still use port-f...
you can do the same in sshd.config but you need to disable shell access, because they still can run their own sshd see this question AllowTcpForwarding no AllowStreamLocalForwarding no GatewayPorts no PermitTunnel no
How to forbid port-forwarding for a password protected SSH user?
1,497,883,180,000
When I use git or curl I get an error which may be related to certificates: With git: > git clone https://github.com/vim/vim.git Cloning into 'vim'... fatal: unable to access 'https://github.com/vim/vim.git/': error:140943E8:SSL routines:ssl3_read_bytes:reason(1000) With curl > curl -v https://github.com * Trying 2...
You apparently have an improperly set up IPv6 configuration. As a workaround (not a fix but that may be complicated or impossible), please disable IPv6 completely on the computer and try the git command again. Disable IPv6 by typing (as root): echo 0 > /proc/sys/net/ipv6/conf/all/autoconf echo 0 > /proc/sys/net/ipv6/...
openssl is not finding any certificates
1,497,883,180,000
I not familiar with shell script for due replace the git clone to another command, Below is the script: git clone https://github.com/yyuu/pyenv.git ~/.pyenv git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv Above two link folder already downloaded: i'm totally genius try to unzi...
just use another directory name in the git clone command, e.g. git clone https://github.com/yyuu/pyenv.git ~/.pyenv2 git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv2/plugins/pyenv-virtualenv or download the packages manually: Go to https://github.com/yyuu/pyenv and https://github.com/yyuu/pyenv-virtu...
How to change git clone to other way if the folder is already downloaded manually by Shell Script?
1,497,883,180,000
So, I have a file, for this instance we shall call it $HOME/Documents/hello.txt. I will write some text inside it: Hello, welcome to my text file And I will hard-link this file here: $HOME/Documents/Backup/hello.txt. Okay, great, this is now hard-linked. If I write to the original file, the hard-link will be updated:...
As mosvy already said in this comment, most editors do the edits in a copy of the original file which they replace (delete) later. While this increases security, it breaks hard links. However, some editors like for example GNU Emacs can be configured to perform file edits in place, which means that they directly alter...
What to do when hard link is lost because of my text editor
1,497,883,180,000
Was creating a script to update a Github application in-place and needed to print changes made in the latest Git tagged release so users could make an informed decision about pulling the trigger on the update before altering a working production environment. A requirement was that I needed to alias the last tag becau...
Since your own solution appears to require that the checked out head match the tag you’re interested in, the following works without a separate git describe: git tag -l -n10 --points-at HEAD
How to show latest release's Git tag with message
1,497,883,180,000
I am trying to clone Wayland repository from git (for a project) but git clone command is throwing me an error. I installed curl (from here). After cloning make && make install. Earlier I had a different version which was working fine with git. Then I again tried cloning Wayland repository and this error popped. fata...
The switch --with-ssl={gnutls,openssl} needs the location of the the header files (*.h) usually in /usr/include/openssl it's a good idea to run configure with --includedir=/usr/include/ telling configure where to look for includes. If /usr/include/openssl exists on your system and is having *.h files - it should be t...
Protocol SSL is not working with Curl
1,548,613,238,000
I was just following the install instructions for zsh-autosuggestions and I don't understand what part of the following command is doing: git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions What does the ${ZSH_CUSTOM:- ...} do? Why not just clone ...
The parameter substitution ${variable:-value} would be replaced by $variable if that variable was set and not empty, otherwise it's replaced by value. This is a standard parameter expansion. In this case, it allows the user to set ZSH_CUSTOM to where they keep their oh-my-zsh customisation files, or to not set it and ...
Understanding environment variable / shell syntax
1,548,613,238,000
I have this in a script: set -e; base="remotes/origin/dev"; git checkout --no-track -b "$new_branch"; git rebase "$base"; on occasion, there are conflicts of course, and what happens is that git rebase exits with 1, and so the script aborts/exits early. So my automated script doesn't work if there are conflicts, whic...
To run the command once, but pause for failure: if ! git rebase "$base"; then read -p "Press ENTER when you think you've fixed it" fi
Allow automated script to incorporate git rebase
1,548,613,238,000
I have 2 different branches A,B that have a (slightly different) version of a file X. I am interested in getting the commits that added some specific patterns in branch B. What I do roughly: diff files| grep "^\+" | grep "$PATTERN" | for loop grep -n.. do git blame -L done This works but I was wondering if I am re-inv...
I think you can combine git blame and git merge-base to get the information you’re after: git blame -n $(git merge-base A B).. -- file | grep -v "^^" | grep "$PATTERN" This finds the common ancestor between A and B, then runs git blame on file, ignoring anything older than the common ancestor (the .. notation tells g...
Getting differences of file between specific revisions/branches
1,548,613,238,000
I use GitLab repositories with two users (myself and a test user). For my test repository I have this in .git/config: [core] sshCommand = ssh -i /test-project/test_id_rsa [remote "origin"] url = [email protected]:test.tester/test-repo.git And I don't use a passphrase at all with test_id_rsa. 'git pull', etc. ...
If this is a key that one reasonably often, the trick is to add that key to keychain: eval `keychain --eval --agents ssh id_rsa a_test.tester_key After that, the right key will get used. If one uses a key less often, or uses a lot of different keys, best just to stop keychain for that.
Keychain ssh-agent overriding specified SSH key
1,548,613,238,000
I'm trying to set up an ssh connection from an OS X box provided by Travis CI to git-over-ssh at github.com. Nothing fancy: my script takes a base64-encoded passwordless private key, decodes it and setups up the following git ssh wrapper to enforce key usage: unset SSH_AGENT_PID SSH_AUTH_SOCK # Setting up bot key ech...
It turned out that indeed the problem was in the contents of .ssh/known_hosts file. Travis's ssh uses pretty much default options, so it would try to ask for confirmation on every new key, which, in turn, will result in this obscure error message. On Ubuntu, Travis team supplies a preset .ssh/known_hosts file, which c...
ssh connection from OS X client problem
1,548,613,238,000
I use my ikiwiki for personal notes only on my laptop locally (the html pages are under ~/public_html/mywiki) and now I am trying to edit it with emacs and push from command line. I have some questions about this: Is the following workflow correct: cd ~/mywiki edit and save ~/mypage.mdwm with emacs git add ~/mypage....
ad question 1: This seems to be correct. If you set git_wrapper to git_wrapper: /home/user/mywiki/.git/hooks/post-commit (instead of git_wrapper: /home/user/mywiki.git/hooks/post-update you don't need the push step. You may also think about another working clone of your wiki. But as long as you have a single user se...
Using ikiwiki via command line: Workflow and permission problem
1,548,613,238,000
We are in the process of moving from other source/version control methods to git and, because I have no actual experience with git (short of setting some user.* variables), I'd like to ask whether this is a viable direction to take before committing myself down this road. The solution in "Is it possible to set the use...
It seems like your solution would have race conditions (what happens during multiple simultaneous invocations of git?) as well as other problems (such as incorrect use of $* instead of "$@". Instead, why don't use just set $GIT_CONFIG in each user's environment to a different file?
Dynamic user config for git with wrapper script?
1,548,613,238,000
I would like to install custom source from a git repository, but using my package manager (emerge for portage). Background I have installed Gentoo using EFI using Sakaki's tutorial, so I have already emerged dev-vcs/git. The packages that I want are for installing Canonical's Snapd (background reading from Ars Technic...
Based off of @likewhoa comments above, the structure of the ebuild needed to be massaged. The creators did not have recent portage structure in mind when creating their git repositories. For Command-line (an ebuild without portage directory structure) Within /usr/local/portage/ I decided that snap-confine belonged u...
How to install custom source from git using my package manager in Gentoo?
1,548,613,238,000
I had a directory such that $ ls $ README.md testA.c testB.c a_large_folder another_folder my most recent add->commit->push consisted of $ README.md testA.c Normally, my lazy self is used to doing git add . but this time I simply wanted to add a_large_folder. When I did, $ git add a_large_folder I was prompted bac...
My guess: you did not have the directory a_large_folder inside when running git add. This is the only reason for git add a_large_folder to report: pathspec 'a_large_folder' did not match any files The syntax is correct and works for either for specific files as well as for a containing directory. See add.c. If you ...
After git, folders and files gone
1,548,613,238,000
I want to tweak the Adwaita gtk3 theme a bit, and I found it here. There are two many files to download, and I had no luck using neither git clone https://git.gnome.org/browse/gtk+/tree/gtk/theme/Adwaita nor svn export https://git.gnome.org/browse/gtk+/tree/gtk/theme/Adwaita I'm sure that there is a way to download th...
You can get it with svn from https:/github.com/GNOME (svn checkout URL is available on the right side of the page). So, to get just the Adwaita sub-directory simply run: svn checkout https://github.com/GNOME/gtk/trunk/gtk/theme/Adwaita
How to download a sub directory on git.gnome.org?
1,548,613,238,000
Since two days I'm struggling with making Gitweb work on my home server machine. I've modified so many configuration files till now, that I've decided to completely remove the Gitweb package from my server and start all over again. I've performed the apt-get purge gitweb command and then I've checked if there's still ...
Using dpkg -c [gitweb-package.deb] in /var/cache/apt/archive/ I've noticed that contents of this package does not contain the files I was looking for, so I've checked the contents of git package and that is where I've found it, so the final solution is to reinstall the git package itself.
Deleted gitweb folder, don't know how to reinstall it
1,548,613,238,000
I have an xargs function that calls git commands recursively. When I now call gitr log I have to hit enter until the end or q to get the next xargs call to run. Can I tell xargs to skip user input or output everything of less at once?
You can call git with the --no-pager option if you want it to dump out everything without running less. Here are details from the man page: --no-pager Do not pipe git output into a pager.
xargs git: skip user input
1,548,613,238,000
I have such a bash script: #!/bin/bash cd /home/user/projekt git config core.sparseCheckout true git pull origin master wait rm -rf /var/www/project/{client,public} cp -r /home/user/project-checkout/project/dist/* /var/www/project/ cd /var/www/project/ npm...
Instead of de-elevating, you could only sudo where necessary; so in your script: ... sudo cp ... cd /var/www/project sudo npm install You can use set -e at the start of your script to cause any error to stop the script, which would have the desired effect on line 3. I'm not sure why you need the wait there though; g...
Running bash script with sudo, and git inside of it
1,548,613,238,000
Recently git branch <tab> started showing me the following error: $ git branch bash: -c: line 0: syntax error near unexpected token `(' bash: -c: line 0: `/usr/bin/git --git-dir=.git for-each-ref --format=%(refname:short) refs/tags refs/heads refs/remotes' HEAD bash: -c: line 0: syntax error near unexpected token `(' ...
Your script does not preserve quotes. The original line executed by completion is: git --git-dir=.git for-each-ref '--format=%(refname:short)' refs/tags refs/heads refs/remotes by your script you get: bash -c '/usr/bin/git --git-dir=.git for-each-ref --format=%(refname:short) refs/tags refs/heads refs/remotes' Note ...
Broken git autocompletion after I have overridden the git command
1,548,613,238,000
I need to check the location of the files, which were changed in the last commit. Because I will have to do this on Jenkins, this should be done using a bash script. This is the output of git whatchanged -n 1 (the command I want to use for this) lukas @ leaf (~/workspace/shairweb) 🐌 git whatchanged -n 1 commit b4...
Try this way: LASTCOMMIT=$(git log -1 --oneline | cut -f1 -d" ") git diff-tree --no-commit-id --name-only -r $LASTCOMMIT
Is there a way using a bash script to get the location of changes made in last git commit?
1,548,613,238,000
How can I execute this search and replace on Linux without getting an error? $ git status On branch main Your branch is up to date with 'origin/main'. nothing to commit, working tree clean $ find . -not -path './.git' -type f -exec sed -i -e 's/old/new/g' -e 's/old2/new2/g' {} + $ git status fatal: unknown index ent...
The -path test of find matches the entire name. From man find (emphasis mine): -path pattern File name matches shell pattern pattern. The metacharacters do not treat /' or .' specially; so, for example, find . -path "./sr*sc" will print an entry for a directory called ./src/misc (if one exists). To ignore a ...
fatal: unknown index entry format after search and replace
1,548,613,238,000
Why can't i clone from a repository hosted on my network? /home/ondre $ git clone http://10.0.8.23/example.git Cloning into 'example'... fatal: repository 'http://10.0.8.23/example.git/' not found I'm using Arch Linux ARM on the server with apache as a webserver. I'm sure i have no typos in the address, because when ...
I found the solution! You need to cd into/the/repository.git and run git update-server-info on the server.
git says "fatal: repository not found" when cloning from a lan apache server
1,637,494,619,000
I'm trying to get RabbitVCS working on Kubuntu (20.04) via Thunar (1.8.14), but try as I might, nothing seems to work. Certainly it doesn't work according to their official install directions. I feel like I'm getting very close, but hit a roadblock & after literally hours of Google, am at a loss for how to proceed. ...
As discussed with RabbitVCS's devs here: https://github.com/rabbitvcs/rabbitvcs/issues/297, it looks like there are multiple bugs in RabbitVCS, as well as multiple inaccuracies in their install instructions. To directly answer my own question above, I was able to get the missing typelib by downloading the rpm from htt...
RabbitVCS Install On Thunar / Kubuntu 20.04
1,637,494,619,000
Trying to install git to 32 bit Centos 7: sudo yum install git Got answer: Requires: perl(Error) How to fix that and install git? Why it is not trying to download perl if needed? UPD: Repositories list on my machine:
Since you provide no information about which YUM repositories you are using (yum repolist), I can only guess that the package that provides perl(Error) does not exist in any of your configured repositories. Looking at the CentOS 7 altarch repositories for i386, I was able to find the package so you should try config...
Install git to 32 bit Centos
1,637,494,619,000
Is it possible to merge two same file automatically? For example, fileA and fileB are two same files. However, fileA is on PC and fileB is on Laptop. If I run git annex import /path/to/fileA and git annex import /path/to/fileB together on each device, it will remain two different symbolic links in git archive tree a...
Git-annex stores its files based on their content hash. So if your two files fileA and fileB are identical, then they should both be recognised by git-annex as the same file. If they are not being recognised as the same file, then it suggests they might be slightly different. You could try comparing their hashes. The ...
Git-annex auto merge symbolic links?
1,637,494,619,000
I have two directories: Libc-825 and Libc-1044. Imagine that version 1044 is newer, but buggy. Is there a way to merge these file trees? I have there C sources with not so big differences. I have heard of using git for such purposes. Edit: I want to get diffs of all the files where names clash, to fix bugs manually
You could use diff to generate a patch with new, old and conflicting files. diff -Naur Libc-825 Libc-1044 The flags state -N treat missing files as new, -a all files are text, -u show lines before and after diff for easier identification and -r recursive. You can then apply the patch to the old directory and get the ...
Merging text file directories
1,444,899,291,000
I have a webserver with a git repo containing a website. I have made a CMS using PHP where PHP automatically commits to git when files are changed. I would like to track these commits (preferably in a form close to git log --name-status to show added/deleted files) using Logwatch. I have read about creating custom Log...
Note: Instead of the PHP code below, if you wanted to track all git commits (and not only those committed using PHP), it should be possible to set up a post-commit hook with similar output. Just after writing the question I came across this really simple guide. Based on that, here's what I did: Create log directory a...
How to make Logwatch track git commits
1,444,899,291,000
I use Xubuntu and found that I can update packages by using apt and apt-get. But I have heard that programmers use usually git in their project to manage different version. So why Xubuntu do not use git to handle different versions of software?
apt and apt-get are related and very different from git. apt is the package management tool for Debian-derived Linux distributions (including Ubuntu/Xubuntu). This is used to manage (i.e. download, install, remove, update) the binary software packages that makeup the Linux distribution you are using. This is about upd...
What is the difference between apt, apt-get and git?
1,444,899,291,000
I was completing the git tutorial found here: https://try.github.io/levels/1/challenges/7 And it said that I had to put single quotes around *.txt. I had not seen this before when using linux but thought it was peculiar. I also have seen single quotes when using html and php as a way to make sure that the string is in...
This is the same in the shell as in the other grammars that you mention. A single quoted string will be treated as a "string literal" (so to speak). The difference between git add '*.txt' and git add *.txt is who's doing the matching of the pattern against filenames. In the case of git add '*.txt', git is doing the p...
What is the difference between '*.txt' and *.txt?
1,444,899,291,000
The top answer to this question demonstrates that cut can be used with tr to cut based on repeated spaces with < file tr -s ' ' | cut -d ' ' -f 8 I want to get the remotes of several Git repos in a directory and am attempting to extract the remote URL fields from each with the following: ls | xargs -I{} git -C {} rem...
That's a tab, not two spaces. You can get the same output safer with a shell loop iterating over the subdirectories in the current working directory that has a .git directory, then cut the first space-delimited field (to remove the (fetch) and (push) labels at the end that git adds) and then pass that through uniq to ...
How to combine tr with xargs and cut to squeeze repeats
1,444,899,291,000
I have two GitHub accounts. One for personal use, and another for business. Each is set up with its own SSH key gh_personal and gh_business inside ~/.ssh. I have a personal project that sits in ~/code/bejebeje. Each time I go to work on that project, I have to remember to run the following: eval `ssh-agent -s` ...
You can create an ssh_config AKA ~/.ssh/config to match different addresses like the following: Host * Protocol 2 PreferredAuthentications publickey,password VisualHostKey yes Host work_gh HostName github.com IdentityFile ~/.ssh/id_rsa.work Identities...
Automatically add ssh key based on directory I'm in
1,444,899,291,000
I have an archive (*.xpi) file in a git repository. How can I track the archive to get a more meaningful git diff then simply Binary files ... differ?
Do not track .xpi file. Track the source files which are content of that .xpi. If the plugin in question is yours - then just add directory with source files into git controlled tree. If the plugin is someone else's and you just download the ready to use .xpi from firefox's site - do you really need track the minute c...
Track archives with git
1,444,899,291,000
I have been trying to install time shift from the directory I cloned from github. I ran the following command: cd src; make install And then I seperatly ran: sudo make all Got the following result in both cases: makefile:4: *** No msgmerge found, install it. Stop. I then tried the command: sudo make all And go...
To install Timeshift on Kali Linux you only need to download it from the repositories. Remove the version you installed yourself by using apt purge timeshift. If you were able to install the package from source, then you can run timeshift-uninstall to remove the software. I would also recommend that you clean up t...
Cannot install Timeshift on Kali
1,444,899,291,000
Normally when I commit a change to a submodule in Git (and if that's the only change), I will provide the result of git diff <submodule-name> to the body of the commit message (with diff.submodule set to log in my git config). So the message would look something like: Updated Core Submodule Submodule Core eaedd3f..07...
The key bit of syntax you're missing here is: git commit -m "$(printf "Updated $submodule Submodule\n\n" ; git diff $submodule)" The use of the $() form of command substitution inside double quotes sends the output of git diff... to git commit as a commit message with newlines intact. I used printf here instead of ec...
A bash script that can automate git commit message contents
1,444,899,291,000
I have git () { [ $1 = commit ] && command git commit -v "${@:2}" || command git "$@"; } It makes git commit have -v as a default, otherwise pass on the params and do whatever the git command is. But it seems like something that could be shortened? fyi, I'm slimming down my .bashrc file. Down to 28 (mostly readable ...
Here's a way to not repeat then command git part: git () { if [ "$1" = commit ]; then set commit -v "${@:2}"; fi command git "$@" } Note that you should not use $1 without double quotes. Always use double quotes around variable substitutions unless you know why you need to leave them out. Don't use && and || ...
Is there a way to make git commit have -v as a default?
1,444,899,291,000
let's say I want to get this branch the same way I get the latest one, using git clone git://github.com/raspberrypi/linux.git. How do I do it?
You need to add the branch tag to the clone process. git clone -b rpi-3.2.27 https://github.com/raspberrypi/linux.git
Getting branch from git
1,444,899,291,000
This is part of a larger script but I distilled the problem down to this: cm_safe(){ git push | while read line; do echo "cm safe push: $line" done; } I want to prepend git output, so it would look like: cm safe push: Everything up-to-date but instead I just get: Everything up-to-date Is git writing to ...
git push writes to stderr so you would have to redirect that to stdout in order for it to be sent over the pipeline: cm_safe(){ git push 2>&1 | while IFS= read -r line; do echo "cm safe push: $line" done } Alternatively you could do: git push |& while IFS= read -r line; do I recommend reading What are the...
How to prepend lines to git command output
1,444,899,291,000
Say I type git help to learn about the merge command. I don't want to read all the output just the lines that contain merge and their surrounding lines. I thought this would be a common question but couldn't find it. I think grep can be used somehow to do this.
Yes, grep can do something like this: its -C option will show the context of a match. Thus git help | grep -C2 merge will show lines containing “merge”, with two lines of context above and below. I find it more convenient to use less: git help | less then search using /. git help won’t tell you much though, you’ll ...
How can I search terminal output?
1,444,899,291,000
I'm trying to make a git alias that shows branch names and descriptions. There is no dedicated command or switch to get the description of a branch; it must be sussed from configuration. However I want to get a list of all branches and their descriptions (if they have one). One can get a sort of "raw data" like so: $...
I would probably use sed for this: sed -n '/^branch/{ s/[^.]*\.//; s/\.[^=]*=/ /p; }' This catches any line starting with the string branch and for each of those lines deletes everything up to and including the first dot, then replaces everything from the first remaining dot up to and including the first = characte...
trouble with two delimiters in awk
1,444,899,291,000
This is on a Mac but I figure it's a Unixy issue. I just forked a Github repo (this one) and cloned it to a USB stick (the one that came with the device for which the repo was made). Upon lsing I notice that README.md sticks out in red. Sure enough, its permissions are: -rwxrwxrwx 1 me staff 133B 15 Jun 08:59 READ...
Because the 'executability' of a file is a property of the file entry on UNIX systems, not of the file type like it is on Windows. In short, ls will list a file as being executable if any of the owner, group, or everyone has execute permissions for the file. It doesn't care what the file type is, just what the permis...
Why would README.md show up as an executable?
1,444,899,291,000
In Bash, given a command which takes a pathname as an argument, does file expansion happen to the pathname argument before the command can see the value of this argument? My question comes from my comment about what does . refer to in the following git commands: git --git-dir=/path/to/my/repo/.git add . git --work-tre...
All expansions take place before the command is run. How the command interprets what it gets is entirely up to it. None of your example commands have any expansions involved - . is not expanded by the shell. The git command uses . after changing directories according to your options, so . won't be your current direct...
Should file expansion happen before a command sees its argument?
1,444,899,291,000
I'm trying to parse the output of commands run in a bash loop. Here is an example: $ for i in `git log --format='%H'`; do echo $i ; git branch --contains $i; done | head -n 8 5f11ce7da2f9a4c4899dc2e47b02c2d936d0468e * foobar e1c3f6fabd45715b527a083bc797e9723c57ac89 dev1 * foobar 7053e08775d2c1da7480a988a235e445799cb...
Something like this might be what you want. for i in $(git log --format='%H'); do branch="$(git branch --contains $i|awk 'NR==1{print $1}')" [ "$branch" != "*" ] && echo "commit '$i' is in branch '$branch'" done Prints the commit and its branch if not the current branch.
Parse lines of output from bash loop
1,444,899,291,000
When I try to verify the integrity of git-man-pages package I downloaded from "http://code.google.com/p/git-core/downloads/detail?name=git-manpages-1.8.4.tar.gz&can=2&q=" it fails with error. Command which i ran: md5sum -c git-manpages-1.8.4.tar.gz Error displayed: md5sum: git-manpages-1.8.4.tar.gz: no properly forma...
If you just want to compute the checksum of the file you downloaded you should leave the -c out. Apologies if I didn't understand your question right. For example: $ md5sum git-manpages-1.8.4.tar.gz e3720f56e18a5ab8ee1871ac9c72ca7c git-manpages-1.8.4.tar.gz md5sum also expects 2 spaces between checksum and file nam...
md5sum check fails for git-man-pages.tar.gz package
1,444,899,291,000
I've been trying to update Git for a while. I'm currently stuck on 1.7.3.4, and I've tried updating to 1.7.4.x, and 1.7.5.x but it never works. Today I compiled and installed Ruby 1.9.2, but it still shows up as 1.8.7. I'm running 10.6.7 on a MacBook Pro. I have no idea why it won't update. Any ideas? :(
Often, software compiled from source will install to /usr/local/bin. This is probably where you are installing your locally-compiled Ruby. A common “downloadable” Git for Mac OS X is the git-osx-installer pre-built version. It installs to /usr/local/git/bin (though I suppose you might have downloaded some other varian...
Ruby and Git refuse to update. (Mac)
1,444,899,291,000
I have a local git version control installed on RedHat 8 server, and when I run git add * it asks me to provide the sudo permissions which is sudo git add * and this makes the add run with the root for me and all the other team do the same. So, when I run git log it provides me with the list of changes however the cha...
So, what's happening here is that you try to use git on files that aren't accessible by your (non-root) user. That might be because the actual source files don't belong to you, or because the .git directory doesn't – which definitely happens once someone (you maybe?) used sudo git. Git is not meant for multi-user repo...
Local Git multi users issue
1,444,899,291,000
I created a script like shown here to simplify clearing out my git remotes. Created the file with the format git-{command} and made it executable. Included file in PATH. The script seems to work if I directly execute it. But as far as I can understand, I should be able to run these scripts directly from git. i.e., ...
I think you need to re-edit because both commands are the same (not matching the image) the PATH variable should not have the full executable in it, just the path to it, i.e. ${HOME}/.dotfiles/git/
Unable to use custom git commands on Mac
1,444,899,291,000
I get the following error when trying to uncompress piped tar file with the following command : $ git archive --format=tar 0af62b1 | tar -xf -C /the/path/here/ tar: -C: Cannot open: No such file or directory tar: Error is not recoverable: exiting now The first part git archive --format=tar 0af62b1 outputs a tar file,...
I would try to pipe your git into tar -xf - -C /the/path/here/ where - is synonymous of the standard input. Or simpler tar -xC /the/path/here (- is the default file).
How to pipe a file as input to tar command
1,444,899,291,000
I have noticed that Git clone can easily download all files of a GitHub repository to to a directory named exactly as the GitHub repository (without having to deal with archives). If a directory with the same of the repository already exists, Git will throw an error: fatal: destination path 'REPOSITORY_NAME' already ...
git clone takes a directory name on the command line too. From man git-clone: NAME git-clone - Clone a repository into a new directory SYNOPSIS git clone [--template=<template_directory>] [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror] [-o <name>] [-b <name>] [...
Git clone; how to deal with directory clashes?
1,444,899,291,000
I'm new in Linux and i am using Ubuntu 20.04.2.0 LTS. I am tring to install git with following steps in this site. When I run sudo apt update or sudo apt-get update command that returns this errors: sudo apt update Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [109 kB] Hit:2 http://dl.google.com/lin...
The servers seem to be down as pinging fails: ping tr.archive.ubuntu.com The simplest circumvention would be to directly use archive.ubuntu.com, i.e. removing the tr. prefix. Ubuntu archives usually have a local mirror to ease the load on the main servers and reduce traffic around the globe for speed reasons. Why th...
How can I get rid of this error when apt update and instal git
1,444,899,291,000
I have the following functions in my .bashrc which just creates a python project with venv and creates gitignore and readme, after I initialise with git as: git init python __git_init_folder_for_python(){ local README=' ### Description Python3 Project ### Installation``` python3 -m venv ./ source bin/activate pip3 in...
How can I make command -v return the correct path You can't. If you want the full path use which. However, I don't think you need this full path. Just call command git ... without the -v flag. The flag doesn't have an intuitive behavior and it doesn't print what command without the flag would do. But, if I use whi...
command -v <foo> returns wrong result after overwriting <foo> as function
1,597,610,216,000
I'm a newbie to the Linux world as well as to git. I recently set up version control to manage my dotfiles by creating a Git repository called 'dotfiles'. However, whenever I commit any changes, I am asked for my Git user name and password and then my user name and email address gets automatically inserted into my .gi...
Git requires that you provide a name and an email address in order to commit. These values are inserted in every commit that you make and they must be nonempty and meet some basic validation. Conventionally, the name is your personal name, but that isn't required by Git itself, although projects you contribute to ma...
How to prevent automatic insertion of your Git user name and email address in gitconfig file?
1,597,610,216,000
I'm trying to install Git using the following commands: sudo apt-get install git-core and sudo apt-get install git Both don't seem to work. It seems that it can't find some packages. This is the result for both commands: My sources list: # deb http://ftp.de.debian.org/debian jessie main deb http://ftp.de.debian.o...
Remove all lines in your sources.list and add the following lines deb http://ftp.us.debian.org/debian/ jessie main contrib non-free deb-src http://ftp.us.debian.org/debian/ jessie main contrib non-free and don't forget apt-get update
Debian 8 - Can't install Git [duplicate]
1,597,610,216,000
I tried the following: $ git clone git://anonscm.debian.org/collab-maint/angband.git Cloning into 'angband'... fatal: unable to connect to anonscm.debian.org: anonscm.debian.org[0: 194.177.211.202]: errno=Connection refused I thought perhaps collab-maint might have moved to salsa.debian.org (the gitlab instance), bu...
As indicated at the old address, Alioth has been discontinued. The Angband repository has not been migrated to Salsa, the replacement service, but you'll find an archive here. I would suggest that you use wget to download the file wget https://alioth-archive.debian.org/git/collab-maint/angband.git.tar.xz then tar -x...
Unable to connect to angband Debian repo
1,597,610,216,000
I'm trying to push code using git to my remote server, but I get the error: fatal: protocol error: bad line length character: 8 I researched this bug and it turns out my .bashrc file that echos out a welcome screen is causing this error. What I would like to do is determine if this is a git push and to NOT display ...
I don’t think there’s anything specific to git push hooks on the server, that you could use, but you could check whether you’re outputting to a terminal: if [ -t 1 ] && [ -e ./.doc ]; then cat ./.doc pm2 list fi This will deal with a number of other cases where outputting the contents ./.doc doesn’t serve muc...
.bashrc is causing git push to fail
1,597,610,216,000
I'm trying to use version control in my music folder to track how I sort it and when I add/delete music. I only need the metadata and not the contents in the repo. To achieve this, I'm using tree to maintain two text files that are in .list in the root directory for the repo. This is the script run by cron every 15 mi...
It is tree that looks into the .git directory. You will want to tell tree to ignore the .git directory. On the Ubuntu machine that I have access to, this is done with tree -I '.git' ...other options... You may also want to have it ignore the .list folder.
git does not exclude .git directory
1,597,610,216,000
Now here is the commit id 41f9f4e392ab50db264e0328de7d69f1f10646eb, I want to get this commit id code which were modified only. I use git show 41f9f4e392ab50db264e0328de7d69f1f10646eb to see modified files, how can I download these both after modified and before modified version via Linux git command? In a word, I jus...
Thanks all, I have found the correct way, here it is. #!/bin/bash from_id=$1 to_id=$2 #echo $from_id #echo $to_id diffpath='patch/diff.log' newpath='patch/new/' oldpath='patch/old/' rm -rf patch mkdir -p $newpath mkdir -p $oldpath git diff $from_id $to_id --raw > $diffpath cat $diffpath | while read line do #ech...
How to get the modified files(before and after) from git version server?
1,597,610,216,000
I have tried several ways to save into a log file 'git fetch output' from terminal, through a bash file but without success, like, git fetch origin > output.log or even adding output.log in the front of the bash script where i have 'git fetch origin'. With command script is the only way i have to record all the info...
Looks like git prints the output to stderr, so you should use >&. Example: git fetch -v >& test.txt
Save into file git fetch terminal output
1,597,610,216,000
I'm trying to understand what does this code means: function git_branch { git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/' } but I don't get it. Someone said this code is made to make a configuration to your terminal, I don't really understand this configuration. Could someone explain m...
This function will return a name of your current git branch. Specifically: git branch --no-color will return the list of branches in your repository, like that: feature/XYZ-124 * master release/1.10 release/1.11 release/1.12 sed -e '/^[^*]/d' Will remove any lines, except for those starting with "*" (wh...
Understanding what git branch means, in this context
1,597,610,216,000
If I used the following command: git log --pretty=format:"%ad %s%d" the output is: Tue Apr 26 11:29:24 2016 +0000 Updated configuration If I do the following: SIMPLE='--pretty=format:"%ad %s%d"' git log $SIMPLE then the output is as follows: "Tue Apr 26 11:29:24 2016 +0000 Updated configuration" I know that I ca...
The difference is because of some shell quoting specialties. If you execute either of these (they are equivalent ways of quoting in the shell) git log --pretty=format:'%ad %s%d' git log '--pretty=format:%ad %s%d' git log --pretty=format:%ad\ %s%d git log --pretty=form'at:%ad %'s%d git log --pretty=format:%ad" "%s%d gi...
Why does git wrap my log output in quotes?
1,597,610,216,000
I have setup of ubuntu Guest VM on Virtualbox on MAC HOST. I have setup the ubuntu as server with the help Created ssh key and put the public key on the Ubuntu and I am able to ssh I have added remote repo like this git remote add origin `ssh://[email protected]:/var/opt/repo-demo.git` but I am not able do a git push...
You seem to be misinpreting single quotes and backquotes, both in the commands you issued and in your question. (Seems to be typical for Apple users). The backquote (below the tilde ~ on a US qwerty) keyboard is different from ', and if you do `ssh://[email protected]:/var/opt/repo-demo.git` the backquotes will make...
git push via ssh to ubuntu VM not working but I am able to ssh to the same ubuntu
1,597,610,216,000
Here is the situation. There are two machines, laptop A and workstation B. B has a fixed IP, A has a dynamic IP, and I want to avoid the need of connecting from B to A (setting up an ssh tunnel for example; for the sake of the argument, assume that ssh from B to A is not possible). There is a git repository, /home/use...
Your post-receive hook has some pretty dire caveats IMO! I have a similar setup, but server B has two copies of the repo. One is a bare repo and used as the default remote ("origin") for both. Then I don't have to supply arguments to "git push" and "git pull". That last is the only simplification I have over the co...
How to use git for this particular purpose?
1,597,610,216,000
I do not have root access on my Ubuntu but want to install git. I was following this tutorial but when running make or make install it says curl is not installed. Can I use wget instead if this is a make config setting?
No, but you could build Git without the Curl dependency on libcurl. It will disable features. Remember that wget is just a binary, whereas Curl provides a shared library as well and that is used by Git. Three options here: ./configure Git with the option --without-curl. Docs say: --with-curl support http(s):/...
make install - how to use wget, not curl
1,597,610,216,000
I see that it takes a --format argument: --format <format> A string that interpolates %(fieldname) from a branch ref being shown and the object it points at. The format is the same as that of git-for-each-ref(1). When I look at man git-for-each-ref I find When unspecified, <format> defaults to %(ob...
TLDR; git config -g color.branch.upstream 'red bold' Git Command: git config color.branch.upstream '<fg-color> [<bg-color>] [<attribute>...]' Git config file: [color "branch"] upstream = <fg-color> [<bg-color>] [<attribute>...] Possible <fg-color> and <bg-color> values: black blue cyan default green ma...
How can I change the output colors of `git branch -vv`
1,597,610,216,000
I want to create a bash function where you can do a sed find and replace while ignoring the files and folders in .gitignore. I also want to be able to add any git grep flags to the command. For example, for an exact match, I should be able to add -w. This is what I have so far: gs { local grep_options=() local sea...
You have a syntax error in function declaration. Instead of w { ... } you need: w() { ... } Always pass your scripts to https://shellcheck.net before asking help: $ shellcheck file In file line 1: gs { ^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive. ^--...
How to add an exact-match flag to the following git + sed function?
1,597,610,216,000
git fetch --all --no-tags doesn't do what it says on the tin, and keeps re-fetching tags every time I run it. How do I actually fetch from all remotes without fetching tags? To reproduce: Fork this repo Clone your fork Add an upstream remote for [email protected]:cachix/install-nix-action.git git fetch --all --no-tag...
Based on my reading of the git-fetch documentation, --no-tags only tells git not to fetch any new tags from your remotes. Cleaning up local tags that no longer exist on the remotes you're pulling from is driven by a different setting, namely fetch.pruneTags. If the output of git config --list shows fetch.pruneTags=tru...
How to fetch from Git remotes without tags?
1,597,610,216,000
There's a lot of setup for this question: I've got a host (rpi5.local) with 2 user accounts: pi and cake. I wanted to explore git, and I created the cake account to "own" the "server/origin" repos. As user cake, in /home/cake, I created a folder (git-srv) with a sub-folder called projectA. I went through the process o...
“Failed to stat” means that a call to stat returned an error, i.e. that the user running git doesn’t have permissions to obtain information on /home/pi/motd.git. That’s presumably because the cake user doesn’t have access to /home/pi. Instead of trying to find the right set of permissions in this case, I think the mos...
After `su user`, getting `fatal: failed to stat : Permission denied` with `git push`