date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,597,610,216,000 |
I added set -u (equiv. set -o nounset) to .bashrc, but now some tab autocompletes fail with errors about unset variables. One example is for git autocompletes.
Would this be a git autocomplete bug or is it generally a bad idea to use set -u in an interactive terminal? Is there an alternative way to protect myself from... |
set -u from the Bourne shell or its more explicit set -o nounset from the Korn shell (both are POSIX) is more of a programming tool, used to detect typos or use of initialised variables in your code.
That's a programming style choice. Once it's set, you can't have your code dereference unset variables, which means tha... | Should I use `set -u` in my terminal? Why does it break autocomplete for git? |
1,597,610,216,000 |
How can git diff color be changed to one's disposal, or such as for diff ...?
in ~/.gitconfig:
[color "diff"]
added = yellow
changed = red bold
not work.
Please sincere help appreciated
|
The git-config(1) manual details the available slots; your added and changed might work instead as new and old.
color.diff.<slot>
Use customized color for diff colorization. <slot> specifies which
part of the patch to use the specified color, and is one of context
(context text - plain is a hi... | Have git diff color customization |
1,597,610,216,000 |
I wish to detect if a staged file has unstaged changes, and add this to a pre-commit hook.
For example, when the output is like this, I should be able to detect that README.md has unstaged changes.
❯ git status
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: README.md
Cha... |
If you use short status, staged content shows up as M in the first column, non-staged content as M in the second column. Thus detecting files with staged and non-staged changes can be done with
git status -s | awk '/MM / { print $2 }'
| Git - find staged files with unstaged changes |
1,597,610,216,000 |
Say, I create a new repo, and try to commit. Git shows me
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
Without reading the last ... |
Simplest is to make a function for this one case (for Bash):
git() {
for arg in "$@"; do
if [[ $arg == --global ]]; then
echo "Don't use '--global'!"
return 1
fi
done
command git "$@"
}
Note that that wouldn't check if --global there is actually an option, and not ... | Is there a way to disallow a certain combination of commands and options? |
1,597,610,216,000 |
This is similar to the question about http not supported, but I was not able to apply the solutions suggested there to my situation.
I've done
zypper addrepo https://download.opensuse.org/repositories/devel:tools:scm/SLE_12_SP5/devel:tools:scm.repo
zypper refresh
and I'm getting
Retrieving repository 'Software config... |
As you've indicated that what I mentioned in my comment worked after you tried it, I'm going to post it as an answer:
zypper install git
git is available in the SLES repos as it is in the repos for nearly every other distribution. In the case of SLES, the above command will install it as long as the repos are enabled... | How to install git on SLES 12? |
1,597,610,216,000 |
Is there an existing tool which will do something like this:
git-cat https://github.com/AbhishekSinhaCoder/Collection-of-Useful-Scripts
then it will run cat on each file in the repo?
Something like this works but it doesn't separate the files:
curl -s -H "Accept:application/vnd.github.v3.raw" https://api.github.com/... |
This is possible with a small modification to your command line:
curl -s -H "Accept:application/vnd.github.v3.raw" https://api.github.com/repos/AbhishekSinhaCoder/Collection-of-Useful-Scripts/contents/ |
jq .[].download_url -r |
xargs -L1 sh -c 'curl "$0" 2>/dev/null | bat'
Having said that, if there are a large nu... | Cat all the files in a git repo without cloning |
1,597,610,216,000 |
I am writing a software. For my work I need to connect to the common git repository, when I turned out that the necessary packages are not installed on my computer. Is it enough to install a single git package into the system?
$ sudo yum -y install git
Or does it require something more?
|
On CentOS,
sudo yum -y install git
is indeed enough to install git.
| Installation of git in CentOS |
1,597,610,216,000 |
I want to set up a server that hosts git repositories over ssh and https with client certificates. I don't want any snazzy GUI or anything like that (i.e. not Bitbucket, GitLab, etc) I want a bare minimum configuration for hosting repositories only.
However, I do want user separation between repositories.
I already h... |
I did this a few years back for SVN. I set up one Unix account. i.e. git@
Added user keys to ~git/authorized_keys, with the extra stuff to run the server (i.e. git-shell) when the user logs in.
So far exactly what you said in paragraph 4.
The bit that you are missing is that each entry in ~git/authorized_keys passes a... | Setting up a git server with ssh access |
1,597,610,216,000 |
My organization gives me no access to root and has some very weird authentication that is explained below:
I login to the RHEL server using my username and password combination via ssh terminal
I am not allowed to use my account and must switch to the server account using the following command: sudo su - appuser
any ... |
You can set environment variables based on your logname:
case $logname in
shnisaka)
export GIT_AUTHOR_NAME="your name"
export GIT_COMMITTER_NAME="your name"
export GIT_AUTHOR_EMAIL="[email protected]"
export GIT_COMMITTER_EMAIL="[email protected]"
;;
olqs)
export GIT_AUTHOR_NAME="my name"
export GIT_COMM... | shell script to run commands after sudo su - appuser |
1,597,610,216,000 |
I wrote myself a pretty, git aware ksh prompt function. Here I only include a minimal working example so that you can see my problem without all the bloat:
#!/bin/ksh
function _test_prompt
{
prompt="`whoami`@`hostname` > "
[[ $(id -u) -eq 0 ]] && prompt="ROOT@`hostname` # "
print "\n\w"
print -n "$pr... |
As usual, I managed to solve the problem after I actually got around to ask about it.
I simply set the pager.log git config variable to less -RFc; the relevant switch is -c as far as I understand: it tells less to repaint the screen from bottom to top instead of doing so vice versa.
Apprently, this was indeed not a ks... | ksh prompt defined as function with newlines |
1,597,610,216,000 |
Recently we have been seeing a lot of connections from IPs in to our public git server. When this happens, our devs are unable to commit via SSH as the server is very, very slow and I am unable to login via SSH remotely and have to login from the console to resolve the issue. HTTPs to gitlab still works when this happ... |
The issue was with my fail2ban config not reading the correct log file. Once I updated my jail.local file and specified /var/log/secure instead of /var/log/sshd.log, I was starting to see IPs go in to the jail. This had fail2ban working but it still wasn't blocking certain log entries. I wanted to block specific entri... | Bulk login attempts on port 22 shutdown our SSH git server access, HTTPs still works though |
1,597,610,216,000 |
I am using Ubuntu 16.04. I have a directory named Work which I want to backup to github everytime I poweroff my computer.
I have written the backup script and it's working fine but I cannot run it before shutting down. Please help.
Here are the contents of backup_work.sh
cd /home/kaustab/Work
git add .
git commit -m "... |
Thank you all for all your help but I have managed to solve this.
What I did was edit the shutdown.desktop in /usr/share/applications and changed the exec to my script. This is what my modified shutdown.desktop file looks like.
[Desktop Entry]
Name=Shutdown
Comment=Backup and power off the computer
GenericName=Shut D... | Backup Work dir to git before shutdown |
1,597,610,216,000 |
I am working on making a git command I use more useful. A common task I do is to grep my git rev-list --all. I wrote (aka cut and pasted another StackExchange answer) git command to do this for me.
~/bin/git-search:
!/bin/bash
function _search() {
git rev-list --all | (
while read revision; do
... |
sed 's/:/ /2'
This would change the second : character to a space.
You could stick that in as an extra stage of your function's pipeline:
#!/bin/sh
git rev-list --all |
while read revision; do
git grep -F "$1" "$revision"
done |
sed 's/:/ /2'
(I actually deleted the function as it didn't seem to be needed; not... | Remove the second instance of a character from a string |
1,597,610,216,000 |
I have a problem with gpg2 and signing my commits in git. I should preface all this by saying this all worked yesterday before I did an apt-get update && apt-get upgrade and a reboot.
Now when I try to sign my commits I get the following error message:
gpg: skipped "3C27FEA3B5758D9E": No secret key
gpg: signing failed... |
You don't have the private part of your GPG key. A GPG key consists of a public key, the piece of information that other computers can use to verify signatures coming from you, and the private key, the part that is needed to create a signature or decrypt messages sent to you. This is why Git is giving you an error. It... | gpg2 and git signing |
1,597,610,216,000 |
I use the "gogs" self-hosted git service, but I want to change to a more active fork called gitea. The installation instructions say I should create a user (e.g. git) dedicated for use by gitea:
adduser \
--system \
--shell /bin/bash \
--gecos 'Git Version Control' \
--group \
--disabled-password \
--home... |
Your confusion stems from the fact that you do not understand what you are doing on Windows. On Windows, actual services are run from the Service Control Manager, and they have had the ability to run under the aegides of dedicated user accounts all along. A proper unprivileged service on Windows employs the username... | Why do I need a dedicated user for a service (my git service: gogs / gitea)? [duplicate] |
1,597,610,216,000 |
i am trying to restrict users to give an unformatted message in git commit-message window. For that i created some formatted regex and trying to put that one in commit-msg hook.
But i am unable to compare the git commit-message string with below regex.
Could you please help me to resolve this ?
regex="[A-Z]{3,}-[0-9][... |
(?:...) is a perl regexp operator. If you want to use those in a shell, you need zsh or ksh93. bash has no support for them. Anyway here, the standard ERE (...) could be used instead.
What \n matches is also unspecified in POSIX extended regexp which bash uses (on most systems, it will match on n only) but note that ... | Unable to compare string with regex using test operator in shell script |
1,597,610,216,000 |
I work with many large files (~0.5-1TB) on a server. I would like a better way to do version tracking of these files on the server.
My limited understanding is that this may be possible with git LFS. I wouldn't actually be storing files, but rather using the storage that already exists.
Linux (or other OS) does keep... |
Have you used git-annex?
https://git-annex.branchable.com/
git-annex allows managing files with git, without checking the file contents into git. While that may seem paradoxical, it is useful when dealing with files larger than git can currently easily handle, whether due to limitations in memory, time, or disk space... | Git and Git LFS: Doing version tracking on files via a server |
1,597,610,216,000 |
git will color it's output. Staged changes are green and deleted files are red for example.
I have a script running several git commands in parallel and I use sponge to get a nicer output.
But using sponge removes the colors, is there a way to change that?
|
Now that I knew what to look for, I found the answer on Stack Overflow:
git -c color.ui=always -c color.status=always status | sponge
| Colored git output piped to sponge |
1,597,610,216,000 |
I am studying my listening services, and I am thinking how identify the type of git listening services so I can kill git the right one in the right situation and/or both.
The services are needed for git push and git pull or git clone [repos], working also for a git server (DopeGhoti).
Code where I do not understand ... |
"So many of them?" It's using precisely one, albeit on both the IPv4 and IPv6 interfaces.
Any service needs to be listening (or have a service aggregator such as xinetd listen by proxy) to some port or socket in order for incoming connections to be accepted.
In /etc/services, you can see git's port, 9418:
git ... | How to identify and kill git listening services here? |
1,597,610,216,000 |
I want an alias shortcut to achieve the following:
Clone a github repository with a custom folder name
Open it in my fav text editor (atom)
I currently use this inside ~/.zshrc:
alias quickstart="git clone https://github.com/myname/quickstart-html-template.git new_html_project && atom new_html_project"
Can I paramet... |
You can't define parameters in an alias, you need to use a function:
quickstart() {
git clone https://github.com/myname/quickstart-html-template.git "$1" && atom "$1"
}
Add that to your .zshrc instead of the alias definition.
| Using zsh alias to quickly clone a git repository with custom folder name |
1,597,610,216,000 |
The git(1) manual page says:
See gittutorial(7) to get started, then see Everyday Git[1]
for a useful minimum set of commands. The Git User’s Manual[2]
has a more in-depth introduction.
Where is either "Everyday Git[1]" or "Git User's Manual[2]"?
|
The links can be found at the very end of the man page:
1. Git User’s Manual
file:///usr/local/share/doc/git/user-manual.html
2. Git concepts chapter of the user-manual
file:///usr/local/share/doc/git/user-manual.html#git-concepts
3. howto
file:///usr/local/share/doc/git/howto-index.... | How could I find those git documents('Everyday Git[1]' & 'Git User's Manual[2]') mentioned in the man pages? |
1,372,926,892,000 |
I have gitolite on a Centos 5.5 box - when a repository is updated, I need to send a command to my bug tracking appliance to get the new commands. Right now, I have the following command working:
ssh bugserver -f 'cd /etc/repos/gitrepo && git pull origin prod && exit'
This seems a little dirty, though. Is there a bett... |
After considering the options, I decided to modify the command (removed the && exit) and left it as is for simplicity.
| What is the proper way to automate SSH/local command? |
1,372,926,892,000 |
I would like to use the code stored in an external git repository (I mean I am not a contributor for this code, I cannot push or create branches) but of course I need to change some files before compile it (for example for path, options, etc).
My question is: could you propose me a workflow to keep track of (only) my ... |
I would use a branch for this:
Clone the external repository locally.
Create a branch based off whichever remote branch is appropriate (I’ll assume that’s origin/main).
Make your changes and commit them to your branch.
Whenever you want to update your branch with changes made to the external repository:
git fetch
... | Track my slight changes to an external git repository I cannot push |
1,372,926,892,000 |
I am using git on Ubunto with bash shell, and a tab-completion using bind '"\t":menu-complete' in my .bashrc file. When I do git diff X, tab-completion starts cycling with matching git tags, instead of matching files. If I complete enough characters such that no tags match, only then does the file-name completion work... |
If you type
git diff --
before starting to enter file names, tab-completion should only consider files.
| git diff tab completion of tags hides file name completion (using bash) |
1,372,926,892,000 |
I have configured git diff to be a command that calls substitute diff for viewing file differences i.e /usr/bin/vim -dR "$2" "$3" and that doesn't work when I want to create a patch using git diff > patchfile.
Is there a way to invoke directly git's own built in diff without disabling the subsitute diff I use for visu... |
git diff --no-ext-diff
In general look for a --no-thing option for turning whatever --thing off. git(1) has a lot of those. Good for conveniently turning off defaults. Sometimes they’re documented together as --[no-]thing and sometimes separately in the man pages.
| How can I call git's built-in diff command directly after configuring a different visual "git diff" substitute? |
1,372,926,892,000 |
Referring to this https://stackoverflow.com/a/31356602, I wrote this code:
#!/bin/bash
# Define the two strings to compare
string1="First string with some random text."
string2="Second string with some random text and some changes."
# Create a temporary directory
temp_dir=$(mktemp -d)
# Create temporary files for t... |
This won't be possible with pipe-based redirection as in your bash's <().
But: with zsh-isms, it should work. There is the temporary file expansion =():
#!/usr/bin/zsh
# use zsh instead of bash
# Define the two strings to compare
string1="First string with some random text."
string2="Second string with some random te... | Performing character-level comparison of "strings" without explicitly creating temporary files for git diff |
1,372,926,892,000 |
My .gitignore file is instructing to ignore the ../../.aws/ directory:
$ cat .gitignore
coredumps/
../../.aws/
.*.sw*
*bak
*log
Alas, that instruction is ignored:
$ git status | head -6
# On branch main
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# ../../.aws/
# ... |
The .gitignore file applies to the files in the same directory where it is located and its subdirectories. It doesn't apply to parent directories or their other subdirectories. You're trying to ignore ../../.aws/, which is two directories above where your .gitignore file is located.
Here are a few ways to handle this:... | How to set `.gitignore` so that `../../.aws/` is excluded from `git status` output? |
1,372,926,892,000 | ERROR: type should be string, got "\nhttps://wiki.postgresql.org/wiki/Working_with_Git#Using_git_hooks\nI want to quickly test my idea (fail fast).\nSo whatever I changed, committed to the local branch. then I switch to a new branch using\ngit checkout -b test1\n\nI can quickly get local as latest as remote (master branch) then I do new changes.\nHow to automate this using git hooks.\n\nhttps://postgresql.life/post/andrey_borodin/\n\nI think what I do is an antipattern. I have at $HOME directories\npostgres0, postgres1, postgres2…postgresE, postgresF, postgres10…\nWhenever I do not understand what I was changing in postgresX - I do\ngit clone https://github.com/postgres/postgres postgresX+1.\nYes, I know git was invented for a reason. But to give a name to the\nbranch I need at least a subtle understanding of what was the purpose\nof changes.\n\nBasically, when I create a new branch, I can get the latest remote automatically.\nBut before I switch if the old branch doesn't commit, the old branch will be lost? (so I need to prevent this).\n\nI want to make sure every time I use \"git checkout -b\", the new branch's local content is as fresh as the latest remote. (That means later when I make some change or break something, it's all my fault) also, the previous branch's changes are still there. (I want to automate this).\n" |
Following a discussion in chat we clarified what the OP wanted.
Suppose the upstream had commits R1, R2, and R3 on it.
The local branch1 had these (R1, R2, R3) and some local commits L1 and L2.
Another commit is made to the remote (R4).
Then a new branch is created locally (branch2) and selected. The question is how t... | Automate when create new git branch |
1,372,926,892,000 |
I'm using git diff to return the file names of files recently changed and i'm trying to pipe the returned file names into a grep expression that searches each file and returns the files that have "*.yml" in the file name and "- name:" in the actual file. However it seems like my code only returns all the files in the ... |
git diff --name-only produces a list of files; you need to give that list to grep in a form it will understand, i.e. as command-line arguments. One way to do this is
git -C "${dir}" diff -z --name-only HEAD^ HEAD | xargs -0 grep -lw --include="*.yml" --exclude-dir="$excluded_paths" -e "- name:"
I added -z so that the... | Return list using git diff and grep |
1,372,926,892,000 |
I have a bash script in a git repo. I used git pull inside the script to update. But sometimes, when I do changes to the script itself, the whole script crashes because it is changed during execution. I want something to update this file but not during the execution.
How could I do this??
|
Universal way
One of the common way to solve such problem is to have two versions of the script - one to run, another to store in repository. It works for any version control system, and even if the script is downloaded from the web.
For example, you can have update.sh.in (add it to repository):
#!/bin/bash
git pull
i... | update during execution |
1,372,926,892,000 |
I wish to create a pull request describing the incoming commits. Is it possible only through the interface or must I do some coding?
My thoughts:
Duplicate pull request template with appended _orig tag;
Parse git log
Add some placeholders manually or programmatically on the pull request copy
Add parsed comments on th... |
This is technically possible, but unpractical in real life.
What if your pull-push cicle contains a few dozens of commits? Once you start implementing a new feature or upgrade versions - the number of commits can easily be in the hundreds (often with comments like: "adding X", "Removing X - bad idea", "Adding X back",... | Add incoming commits to pull request description |
1,372,926,892,000 |
With this .gitignore I expect that *.log files under directory test will not be included in any git transactions
:> cat ~/test/.gitignore
*/*/*.log
*/*/*__pycache__*
*/*/*out
However I have this conversation which suggests my gitignore is not defined to do what I expect.
Where is my error? Am I misinterpreting the co... |
If you just want to exclude the directory test you can add a new .gitignore to the test directory with the following:
*.log
You can also replace what you have in your current .gitignore:
*/*/*.log
with
**/*.log
to remove tracking from all .log files in directories of the project.
| trouble with gitignore |
1,372,926,892,000 |
Perhaps a dumb question, but I am new at this - so please bear with me.
Here is a brief description of the situation:
I recently learned of a significant, long-standing bug in dhcpcd - the default network manager for RPi OS. Coincidentally, someone submitted a pull request to the dhcpcd GitHub site that was committed... |
To clean a Debian package, i.e. remove all generated files and restore the source to its initial state, run
fakeroot debian/rules clean
dhcpcd5 is a “3.0 (quilt)”-format package, so extracting it with apt source etc. will extract it and apply any patches. You can further make sure of this by running
quilt push -a
... | Conversion of Debian "source package" for use on GitHub |
1,372,926,892,000 |
The code below is adapted from a solution to "Use Expect in a Bash script to provide a password to an SSH command", so as to pass arguments to git push. I'm not getting any exceptions for passing the wrong uname+pwd, and conversely passing the correct ones does not actually push anything. How can this be corrected?
gi... |
To address the expect questions:
expect - <<EOF
spawn git push
expect 'User*'
send "$user\r"
expect 'Pass*'
send "$pass\r"
EOF
single quotes have no special meaning in expect, so you are looking for literal single quotes in the User and Pass prompts. Those prompt will not contain single quotes, so the expect co... | How to correctly use spawn-expect-send for 'git push'? |
1,372,926,892,000 |
To apply some changes to all my pom.xml files, I'm running these commands:
git checkout --theirs **/**/**/**/pom.xml
git checkout --theirs **/**/**/pom.xml
git checkout --theirs **/**/pom.xml
git checkout --theirs **/pom.xml
git checkout --theirs pom.xml
But I can't find the replacement that would target all the pom.... |
There are two possible answers here depending on your requirement. You can't use a shell wildcard to match a file or directory that doesn't yet exist, so you cannot use shell wildcards to instruct git on which items to check out unless they are already present in your filesystem. Fortunately git itself does support wi... | pom.xml, **/pom.xml, **/**/pom.xml, then **/**/**/pom.xml... What shortcut to target a file we know its name, whatever its depth in directories? |
1,372,926,892,000 |
In my .zshrc, I am using following git command (from zsh prompt: check whether inside git repository and not being ignored by git) to check whether I am inside a git repository, so that I can change the prompt accordingly:
git check-ignore -q . 2>/dev/null
if [[ $? -eq 1 ]] ; then
But this command does not distinguis... |
Presumably you care about write permissions on the .git directory itself; if so,
git check-ignore -q . 2>/dev/null
if [[ $? -eq 1 && -w "$(git rev-parse --show-toplevel)/.git" ]]; then
will run the then block only if the current directory is a non-ignored directory in a git repository, and the relevant .git directory... | zsh: check whether I am currently inside my git repository (git check-ignore) |
1,372,926,892,000 |
I have on system A a (remote, read-only mounted from server B via sftp/sshfs) filesystem with data on it that needs to be pushed to a remote git repository regularly.
I was not able to find a git command that just takes the contents of a directory (and its subdirectories) and pushes it to a remote repository, without ... |
Git cannot push the contents of a directory to a remote server without having some sort of repository to store the data in. However, if you want to store the Git directory on a different disk or partition, you can do so.
To do that, you can set the environment variable GIT_DIR to point to the directory you'd like to ... | Push contents of a read-only file system to remote git repo |
1,372,926,892,000 |
I Stowed a couple of files which were in a folder. This folder is a config folder and has other temp or system specific files which I don't want in my Git backed Stow backup.
What is the best way to only commit intentional files in Stow's git repository? Is it more or less not using git commit -a?
Regards
|
Add a line with just * to the .gitignore file. git add will then only add files or directories when you force it to with the -f option.
For example:
$ mkdir /tmp/git-test
$ cd /tmp/git-test
$ git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To conf... | Non-stowed files in stow directory and git |
1,372,926,892,000 |
For example, in this page :
https://elixir.bootlin.com/linux/latest/source/arch/arm64/boot/dts/arm/fvp-base-revc.dts
I want to download the .dts file. But if I just do
wget https://elixir.bootlin.com/linux/latest/source/arch/arm64/boot/dts/arm/fvp-base-revc.dts
it's not .dts file but a html-like file.
How can I downl... |
As far as I’m aware, Elixir doesn’t provide a way to download the raw file it presents through its web interface. Instead, you should download the file you’re interested in from a git repository, e.g.
wget https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/arch/arm64/boot/dts/arm/fvp-base-revc.dt... | how to get raw file from a web page showing source file? |
1,372,926,892,000 |
Goal
Clone repos into subdirectories named .owner.login (argument in Github's REST API) with jq, git clone, and xargs.
Preface
I took a code somewhere that allowed me to clone repos with jq, git clone, and xargs. However, I was not able to set it up so that it would make a new parent directory for each repos. (I am ... |
As you don't give us a specific Github user for reproducing your specific issue, I have tested with other Github accounts that I know of myself.
There are two main issues with your attempts.
The individual arguments read by xargs should ideally be quoted.
xargs needs to call git clone with two separate arguments: the... | git clone repos with xargs and jq to a subfolder with the name of .owner.login (part of .full_name) |
1,372,926,892,000 |
In ubuntu Linux, I have a bunch of abominably broken symlinks like:
$ ls -l setup.conf
lrwxrwxrwx 1 ont ont 27 Aug 19 15:26 setup.conf -> '# Source it'$'\r''. ../setup.conf'
They are the result of an attempt to replace all symlinks in a project with a comment and a source call (". ../setup.conf") of the target file. ... |
I'm not entirely sure whether you want to fix the symlinks or replace them with text files. This solution replaces the symlinks with text files:
find -type l -exec bash -c '
for f in "$@"
do
t=$(readlink "$f")
rm -f "$f"
printf "%s\n" "$t" >"$f"
done
' _ {} +
You can test non-destr... | How to change a symlink (viewed as a text file) to the content of that text file (i.e. "remove symlink bit")? |
1,372,926,892,000 |
Is it possible to bulk/sequentially download all of the *.tar.gz from a GitHub repo? Instead of manually downloading everything, is it possible to do so using a certain command or would I have to create a script? I'm using Linux.
|
You should first consider simply cloning the repository with git, it's then easier to do comparisons between releases. That's out of the scope of this Q/A.
I present two methods: a web-based approach, and a GitHub specific approach using an API:
Web scraping
Here's a quick-n-dirty one-liner script (split here into mul... | Bulk download of certain files from a GitHub repo |
1,372,926,892,000 |
I am starting with bash and I had this expression line. I am lost figuring what it is means.
what does this line in shell regex expression mean?
find . -name '*.sh' | sed 's#.*/##' | sed 's#\.sh##'
|
The find statement searches the current directory and its sub-directories for all files ending in .sh and prints them one file per line.
The s operator of sed substitutes matched substrings with something else.
The syntax is s<delimiter>regex<delimiter>replacement<delimiter>.
Usually / is used as the delimiter but her... | regex expression shell help finding the meaning |
1,372,926,892,000 |
Is there a way to fetch the remote repository of a non-checked-out remote repository with git?
I have the dotfiles on my remote PC under version control (using yadm). This repository is cloned on my local PC (also using yadm). But on my local PC I'm using a different dotfiles management utility (rcm) which allows for... |
Since each of the repositories are not bare repositories, at least where it matters, they are not. Therefore, the default behavior seems to be what has been observed, i.e., repository 3 only sees the checked-out commit of repository 2.
To override this behavior, git fetch has an optional refspec argument which can be... | how to fetch the remote repository of a remote repository which is not checked out in git |
1,372,926,892,000 |
I have a laptop, where repository A, which reside in the home directory, under an example name test.
I have commited a couple of things, namely text file, etc into that same repository.
The usb stick, which is plugged in the laptop, is automatically mounted using a cronjob.
What are the ways to sync the repository bet... |
Inside repository A, add the repository on the USB stick as a remote:
git remote add usbstick /mnt/...
Then you’ll be able to push your changes:
git push usbstick master
(if your branch name is master).
If you make changes to the USB stick elsewhere, you can pull them using git pull. If you make changes in both repo... | Git - Sync local repository between a usb stick and a computer |
1,372,926,892,000 |
I'm trying to install Picom compositor on Ubuntu and have installed all the dependencies but when I get to the "To Build" section of the guide of GitHub I have to run three commands:
$ git submodule update --init --recursive
$ meson --buildtype=release . build
$ ninja -C build
None of which seem to work. Running the ... |
You first have to clone the repository i.e bring the code at the github to your computer and you can continue. So run these commands.
$ git clone https://github.com/yshui/picom.git
$ cd picom
$ git submodule update --init --recursive
$ meson --buildtype=release . build
$ ninja -C build
| `not a git repository` when following install instructions for picom (a compton fork) |
1,372,926,892,000 |
I have two servers which I'm running the command git fsck on specific bitbucket repository.
in both servers, I'm getting this output:
Checking object directories: 100% (256/256), done.
error: object directory /XXX/XXX/XXX/XXXX/XXX/objects does not exist; check .git/objects/info/alternates.
error: HEAD: invalid sha1 po... |
As suggested by @vonbrand in a comment, it was a git version issue. once I upgrade it, it was aligned.
another issue was the structure, I had to create a similar structure with soft link to get rid of those errors.
| different behavior for git fsck |
1,372,926,892,000 |
Using git, I often create local branches and then want to push them to the remote (e.g. Github). This requires the -u or --set-upstream flag.
Here is what git outputs without this flag:
$ git checkout -b newbranch
$ git push
fatal: The current branch cross_val has no upstream branch.
To push the current branch and se... |
You could set up an alias that pushes the current branch to the remote.
Configure the alias with the following command:
git config --global alias.rpush '!git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)'
The git rev-parse --abbrev-ref HEAD command returns the name of your current branch. Then run it ... | Git: autocomplete my prompt after failed push because missing -u flag |
1,372,926,892,000 |
I'm reviewing a repo and I'd like to make some comments, it would add more content like adding comments, make some changes ..etc.
How to change content of files of previous commit and do push, I'm aware that commit history would be changed and all affected files would be changed also, but would git compare the affect... |
What you are asking for is to rewrite history n to 0 commits back. This is generally a bad idea as it would make you repo out of sync from the remote and any other repo that is based on it. This would further complicate things so that others wouldn't be able to merge anymore and would require any other repo to delet... | Git: change content of previous commit and push [closed] |
1,372,926,892,000 |
I tried links in this article, seem doesn't work for me: https://stackoverflow.com/questions/31801271/what-are-the-supported-git-url-formats
Problem that I have setup a local git server at /srv/repo/ for example, and when I create a repo under it name test.git with --bare under username testuser, I'd like to add this ... |
If you are using the SSH protocol to access the server-side repository, your read/write permissions are determined by the user/group/world permissions on the server. To set this permission on the repository, you can use the git init command with the --shared parameter when you create your repository. Setting --shared=... | git: URL format to access remotely local git server |
1,372,926,892,000 |
Whenever I do anything with mercurial (e.g. hg status in a repository folder) I get a message saying:
extension 'git' overrides commands: gclear git-cleanup gimport gverify gexport
and the relevant part of my ~/.hgrc is:
[extensions]
hggit =
hgext.git =
Removing any one of these two lines makes the message go away... |
The problem is that you are including hg-git twice.
hggit =
Is the recommended way
hgext.git =
Is the older way to enable an extension and is available in mercurial just for backwards compatibility.
I would suggest using just the first.
| Which hg-git line should I remove from my .hgrc file? |
1,524,057,191,000 |
I want to install the package from the following URL:
https://github.com/VegetableAvenger/ARPSpoofing.git
I have executed the command git clone https://github.com/VegetableAvenger/ARPSpoofing.git
and have changed to the directory using cd command.
Please, how do I install it?
|
To compile the source code you cloned, issue make in the project directory. To "install", you would copy the resulting executable ARP_Spoofing to any directory in your $PATH; or just leave it where it is and execute it from that directory as ./ARP_Spoofing.
Ideally you would read the C++ source prior to running the r... | How to install packages from git |
1,524,057,191,000 |
I am working with the git filter branch for one specific task. It is using the sed command. When I use simple regex everything is working but for something more complex it is not. Maybe I have mistake in the regex or in the escaping chars. Please help.
git filter-branch -f --msg-filter 'sed -e "s/\[PEM-2233\] Merge br... |
You can't nest single quotes. The single quote before master closes the quoted string starting after --msg-filter.
As you can't include single quotes in a single quoted string, you need to end the string and properly escape the quotes:
branch '\'master\'' of http
| sed not catching the expected text |
1,524,057,191,000 |
I'm trying to set up visual mode mappings for quickly editing git's generated rebase list from when doing interactive rebase (e.g. git rebase --interactive upstream/master). In such you're presented with a text file that looks like this:
pick 12345678 commit message 1
pick 23456789 commit message 2
pick 34567890 commi... |
It's an escaping thing. Either always use \\| instead of \| or try
autocmd FileType gitrebase vnoremap <buffer> <localleader>p :s/\v^(pick\|reword\|edit\|squash\|fixup\|exec\|drop)/pick/<cr>
| How to substitute words in git rebase file |
1,524,057,191,000 |
I'm running the following command to download a single file from git:
git archive --remote=ssh://host/pathto/repo.git HEAD README.md
The contents of the file are directed to terminal, before I see the contents of the README I have some header information, that looks like this:
pax_global_header00006660000000000000000... |
I found that piping into tar xvf - solved the issue:
git archive --remote=ssh://host/pathto/repo.git HEAD README.md | tar xvf -
| Cat file dealing with header? |
1,524,057,191,000 |
I cannot clone any repository anymore.
$ git clone [email protected]:myaccount/myrep.git
Cloning into 'myrep'...
conq: repository does not exist.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
The thing is my ssh id_rsa key is still the s... |
Solved. I am speechless. I had made a quick check for a ~/.git-whatever file using bash autocompletion (tab), it did not work so I blindly assumed the issue was somewhere else. Patrick's comment shed the light: I carefully checked using ls -a ~/, the ~/.gitconfig he wrote about really is here, and it holds the informa... | git retains remote information from a deleted repository |
1,524,057,191,000 |
This is my .gitconfig as it stands now :-
$ cat .gitconfig
[user]
name = Shirish Agarwal
email = [email protected]
[credential]
helper = cache --timeout=3600
This is in -
$ pwd
/home/shirish
Obviously I have obfuscated my mail id a bit to prevent spammers etc. from harvesting my mail id here.
But let'... |
I don't think that's possible. There are global configuration options and per-repository-options. If you use different email addresses in different repositories, you need to set them on a per-repository basis.
You can configure an individual repo to use a specific user / email address which overrides the global config... | How to have a global .gitconfig for 2 or more git repos? |
1,524,057,191,000 |
I am trying to achieve something along the lines of
diff -ywB --suppress-common-lines `git branch --merged prod-server` `git branch --merged test-server`
so that I can know the difference of what has been merged into my test server branch but not in my production server branch
But when I execute the command above my... |
Use process substitution on bash:
diff -ywB --suppress-common-lines <(git branch --merged prod-server) <(git branch --merged test-server)
| how to pipe output from git commands into unix diff utility? |
1,524,057,191,000 |
I'm trying to build a custom kernel from a git repository on my Ubuntu virtual machine. I run the make command as follows :
sudo apt-get install vim libncurses5-dev gcc make git exuberant-ctags
mkdir -p git/kernels; cd git/kernels
git clone -b staging-next git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.g... |
staging-next is, as of right now, currently broken, specifically f823182bc289 of staging-next is broken.
If you really want to use staging-next, check out fcf1b73d08cd, which is near the top and does compile.
| Compilation error when building a custom kernel |
1,524,057,191,000 |
The Codeswarm project provides a software project repositories visualization tool in Java. The software leverages the commit information from a log generated from a repository. The rendering illustrates the development efforts with an organic node visual render. Color is applied to specified file extensions to differe... |
Relevant directory structure
Once you have extracted Rictic's fork archive with unzip, take a quick look at the directory structure:
/code_swarm-master
|_bin <----convert tools
|_data <----activity.xml(converted .log file), sample.config
|_dist <----compiled code_swarm.jar
|_lib <----librarie... | Codeswarm software project visualization: how do you set it up with opengl rendering on a contemporary 64bit Linux system? |
1,524,057,191,000 |
I didn't prevent same problem:
I don't use git rm projects.py and when i use :
git cp projectsTABTAB
projectsFindFrame.py projectsInsert.py
Also when i use:
git show a3ea2118bf1c5e2c6aa0974d0b6ff7415bd044ef
I prevent to content of projects.py file:
commit a3ea2118bf1c5e2c6aa0974d0b6ff7415bd044ef
Author: Mohsen Pahle... |
From your Tab completion results, it looks like projects.py isn't in the current checkout. Or at least, it isn't in the current directory. Say git ls-files | grep projects.py to find out if Git believes the file exists here and now, in your checkout.
If ls-files doesn't show the file, you need to find out which branch... | a file to be in git or not to be? |
1,524,057,191,000 |
I'm using yocto to build my custom Linux distribution. I need to add hiredis to my distribution. hiredis is a minimalistic C client library for the Redis database, and I need it to access Redis by a C application.
The recipe hiredis_0.14.0.bb
In my yocto build system there is the recipe hiredis_0.14.0.bb stored in the... |
As @Kusalananda tells in his comment:
the release of hiredis downloaded from GitHub is selected by the commit hash assigned to the variable SRCREV.
For example to fetch and compile the release 1.0.1 of hiredis I can add to the folder my-meta-layer/recipes-extended/hiredis a file hiredis_%.bbappend and, in it, set th... | In a yocto recipe, what selects the release to download from the GitHub repository? |
1,524,057,191,000 |
I'm strugling with a script to backup config files from root folder that copies the file inside a folder in myuser directory, reproducing the original path structure, adds the file to a git repo and commits changes. The script take the path of config file to be backed up as argument:
BU.sh /etc/apt/sources.list
Appar... |
You start your script with:
export GIT_DIR=/home/myuser/config-BU/.git
export GIT_WORK_TREE=/home/myuser/
Your working dir should actually be /home/myuser/config-BU.
That's why when you run git status you see:
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git r... | Problems with git commands in a bash script on runs following the first |
1,524,057,191,000 |
I want backup some config file in a git repo inside my home; earlier I've been using work-tree=/ but i don't like this solution anymore.
Now I'm trying to create a script that take a given config file, copy it inside my backup repo, add it to git, and do a commit. My attempt is:
cp --parents $1 /home/myuser/config-BU/... |
You easily end up in quoting hell when trying to pass complex commands to something like su or sudo.
In this case I guess the easiest approach is to use sudo within the script only:
#! /bin/bash
[[ $1 =~ / ]] && mkdir -p /home/myuser/config-BU/"${1%/*}"
sudo install -o myuser -m 600 "$1" "/home/myuser/config-BU/$1"
... | bash script to backup config file inside git repo reproducing its path |
1,524,057,191,000 |
I have a very specific use case. The DesignSync versioning system we use replaces files with their symlink to the remote repository when we check-in a file.
Since I use git locally to version my changes before checking it in, I don't want "replacing a file with a symlink" or vice versa to be considered a change in the... |
I don't think there's a "beautiful" way forward here, aside from moving away from that symlink methodology (I don't know whether that's a feature DesignSync has. You might need to hope Dassault sees the errors in its ways.) You're just trying to use two different code versioning tools, with contradicting approaches, a... | How can I make git treat symlinks as a file? |
1,678,812,749,000 |
This is the completion code in my .zshrc:
autoload -U compinit
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
zstyle ':completion:*' menu select
zmodload zsh/complist
compinit
_comp_options+=(globdots) # Include hidden files.
I've been having a problem with the autocompletion when i use an alias:
con... |
After investigating a bit I found out that it's a problem with the expansion of the $HOME variable, but the solution suggested here works perfectly, I just replaced --work-tree=$HOME with --work-tree ~ and it worked.
| Zsh autocompletion for git bare repos |
1,678,812,749,000 |
I have a CSV file
:> file save.dat
save.dat: CSV text
This is made of lines like this:
2022-12-31,08:36,meer,CLOSE_WRITE|CLOSE,/hd2/projects/inv,900.Oliver.odt
My local file has a line that differs from the MASTER version by a single line that is guaranteed unique through the algorithm that generates the lines.
G... |
After comment by @Aaron D.Marasco I added the .gitattributes file to the project root directory.
The problematic file is named save.dat so the attributes file wants this
*.dat text
| git: merge of csv files |
1,678,812,749,000 |
When I print a file from git using the command, there are edge cases:
git diff --no-renames --name-only
Edge case 1: spaces
(added --diff-filter=D for illustrative purposes)
# format 1: unquoted
$: touch 'foo bar.txt'
$: git add 'foo bar.txt'
$: git commit -m 'test'
$: rm 'foo bar.txt'
$: git diff --no-renames --na... |
git diff --no-renames --name-only -z | xargs -0 -I {} sh -c 'rm -- "{}"' is what I went with.
| Control the way git prints file names so that they can be passed to rm? |
1,678,812,749,000 |
I recently learned about pass git integration, which allows to sync my passwords with a remote git repo. Which I instantly didn't hesitate to configure.
So then I decided to clone this repo on another computer (with another GPG key installed) and try to access the passwords. It however complained:
pass myaccount
gpg: ... |
I still haven't tried it myself, but pass should be able to encrypt passwords for multiple GPG keys, so transfer the public key from the second computer to the first, and run pass init <id-of-GPG-key-1> <id-of-GPG-key-2>, then pass should encrypt all passwords in your store that aren't encrypted for those two keys for... | How do I access my passwords from `pass` from another computer without transferring private GPG keys? |
1,678,812,749,000 |
I need a small help in writing an ansible playbook. I have written the below till now which is listing all files with config basically. but I need to filter out the files which are basically .git/config
- hosts: all
connection: local
gather_facts: no
tasks:
- name: "Serching old git URL"
become: true
... |
There is an excludes option to the find command that I think will do what you want.
excludes: '.*./.git.config'
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/find_module.html
| Ansible find files only if contains particular string |
1,678,812,749,000 |
I would like to create separate files based on the first chromosome mentioned in the header line. There are 24 chromosomes mentioned in the header line and their sequences are mentioned in the next 2 lines. The file architecture is:
header
human sequences
other genome sequences
However, all the chromosomal sequences a... |
$2 denotes the 2nd column
"chr19" means we are searching for only details associated with "chr19"
{c=3}c-->0 commands to output the next 2 lines of the searched pattern
awk '$2=="chr19"{c=3}c-->0' file > chr19_file
| Splitting a file into separate files based on a keyword on a particular column of each header line |
1,678,812,749,000 |
I am currently trying to create a short and portable way to check if my working git directory is dirty and return T/F accordingly.
My ultimate goal is to incorporate this into a Makefile and I have implemented it as such:
GIT_DIRTY := $(shell [[ -n $(git status -s) ]] && echo '\ dev')
My issue is that the [[ o... |
GIT_DIRTY := $(shell [ -n "$(git status -s)" ] && echo '\ dev')
should work - but it doesn't, even though the command works fine in sh. It seems something in the shell function of make does not like the command.
Here's a workaround using a simpler command to give to shell and using a conditional function in make itse... | Checking command nested in conditional with shell [duplicate] |
1,678,812,749,000 |
I have created a program in my personal computer and I want to upload all its files into an empty GitHub repository.
I cannot do so from GitHub GUI because some of these files are directories and currently GitHub GUI rejects uploading directories.
Could I use Git to upload these files, perhaps by a "pull request" to t... |
If you visit your empty repository on GitHub using a web browser, you’ll see instructions explaining how to populate it (see this empty repository for example):
Prepare a directory containing everything you want to upload, if you haven’t already done so.
Initialise a git repository inside it:
git init
Add all the ... | Uploading files, some of which are directories, into an empty GitHub repository |
1,678,812,749,000 |
When I'm coding, I usually have 2 terminal tabs open in VSCode. The tab on the left is used for git commands. The tab on the right always has git log --all --graph --decorate --oneline showing me all the branches and commits.
I'm trying to make it so that the tab on the right reruns the git log command as soon as I ch... |
Take look to the bottom right there is the (END) this comes from the pager used by git.
There --no-pager to avoid this issue
Then do while to react to each event around inotifywait:
while inotifywait .git/refs .git/HEAD ; do
git --no-pager log --decorate=sh... | How to create a bash script that watches my local git repo and runs 'git log' every time I commit/checkout -b/push/status? |
1,678,812,749,000 |
I am trying to clone a repo from gitlab into Oracle VirtualBox VM (CentOS) hosted on Win 10 machine.
Following are the steps:
generate key via ssh-keygen -t rsa and copy the key from generated id_rsa.pub file into gitlab > preferences > ssh keys
Run the following git command to clone the repo - but it fails with err... |
Ok so the issue was that in my PATH variable /usr/bin entry somehow preceded usr/bin/git - this was a duplicate entry along with the one at the end of the PATH variable - this caused the issue. Learnt another way of not causing a mistake.
| Unable to clone repo from gitlab into Oracle VirtualBox VM (CentOS) - host key verification failed |
1,678,812,749,000 |
I'm writing a tampermonkey script, using git and jsdelivr to store and send it to the users.
For the jsdelivr to work correctly, i need to change the commit hash in the url.
// @require https://cdn.jsdelivr.net/gh/tunisiano187@2020072501/WME-send-to-slack/WMESTSData.user.js
In this case the part to be replaced... |
sed "s/187@[[:xdigit:]]*\/WME-/187@newhash\/WME-/g"
If you need to use extended regular expressions, use sed -r.
| Help with regex with sed -i for a tampermonkey script |
1,593,423,671,000 |
I have the below path for our Bitbucket repositories
/bbshared_storage/archive/data/repositories
The directories inside go by numbers (each number represent repository):
1000, 1001,1002 and so on.
Inside each repository, I have the repository-config file, which contains the project name:
[bitbucket]
hierarchy = X... |
I wrote the below, although I guess there is a better way:
for /bbshared_storage/archive/data/repositories/*
do
cd /bbshared_storage/archive/data/repositories/"$i"
Rep=$(grep -E 'project|repo' repository-config | tr '\n' ' ')
git fsck
if [[ $? == 0 ]]
then
echo "$Rep Good">>/tmp/BB_list.l... | Help with writing script file for bitbucket repositories File System ChecK |
1,593,423,671,000 |
{
"changed": false,
"cmd": "/bin/git clone --bare ssh:********@enterprise.acme.net:7999/acme/acme-whm.git /usr/local/acme/.git",
"msg": "Warning: Permanently added [enterprise.acme.net]:7999,[10.0.37.37]:7999 (RSA) to the list of known hosts.\r\nPermission denied (publickey).\r\nfatal: Could not read from remote... |
Regardless of whether or not you can connect to Ansible and what your options are with Git if you see the following message,
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE... | Ansible git Permission denied (publickey) |
1,593,423,671,000 |
Here’s a Yet Another Question about the clash between ssh and gnome-keyring-daemon, since after spending hours and hours on the Internet I finally gave up.
Environment
OS: openSUSE 15.0
DE: XFCE
gnome-keyring-daemon version: 3.20.1
seahorse version: 3.20.0
git version: 2.16.4
ssh version: OpenSSH_7.6p1, OpenSSL 1.1.0... |
I think I finally found a nearly perfect solution: FunToo Keychain.
It's a deliciously simple console application which you just add to your ~/.bashrc, and then every time you open a terminal it automatically unlocks your SSH keys.
Basically the only difference between it and the gnome-keyring+Seahorse combo I was usi... | Yet another `sign_and_send_pubkey: signing failed: agent refused operation` |
1,593,423,671,000 |
I want to delete a particular branch in a repo with help of api using shell script
i have gone through official document https://docs.atlassian.com/bitbucket-server/rest/4.14.4/bitbucket-branch-rest.html which has details of api to delete all the branches of a repo but not specific branch in a repo
|
Got the answer , below is the api
{bitbucket_url}/rest/branch-utils/1.0/projects/{project_name}/repos/{repo_name}/branches -H "content-type: application/json" -d "{"name": "{branch_name}" ,"dryRun": false}"
| Deleting a particular branch of a in bitbucket repo using API (Shell script) |
1,593,423,671,000 |
I have a dynamic menu on dialog (the items are provided from an array) but the menu is not displaying the selected option
gp_options=()
for i in `find ~ -type d -name .git`; do
gp_options+=("" "$i")
done
gp_dialog=(dialog --stdout --extra-button --help-button \
--ok-label 'Access repository' \
--extra-label 'Crea... |
After hours of research, i finally found a answer:
repositorios=() ; i=0
while read -r line; do
let i=$i+1
repositorios+=($i "$line")
done < <( find ~ -type d -name .git )
gerenciar_repositorios=$(dialog --stdout --extra-button --help-button \
--ok-label "Acessar repositório" \
--extra-label 'Criar repositóri... | can't output dialog value on bash |
1,593,423,671,000 |
After the upgrade to Fedora 27, I can't clone urls using https anymore, ssh works fine. The error is:
fatal: unable to access 'https://repo-url': SSL certificate problem: unable to get local issuer certificate
I didn't change anything and my /etc/pki directory is almost the same like the one of a friend who's still us... |
Here are my ideas (I'd suggest to try again after each step so you can stop when your problem is fixed):
Reinstall git-core (because it contains the relevant component: /usr/libexec/git-core/git-remote-https. I used strace and dnf provides to find that out)
Reinstall ca-certificates (Should be Version 2017.2.16)
Go ... | Can't clone https urls with git |
1,593,423,671,000 |
I am following a tutorial on installing git on a shared host and need some clarification if possible.
I have access to the GCC
jpols@MrComputer ~
$ ssh nookdig1@***.***.**.*'gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the sourc... |
The '~' character is used to indicate the current user's home directory on UNIX systems. Because the username on your computer is different from the one on the machine used in the tutorial you referred to, different directory paths have been appended to the PATH variable. By using '~' one does not have to manually en... | Clarification on updating path in bashrc |
1,593,423,671,000 |
I'm trying to write a program that will get an object from github, without cloning the entire repo. The last line does not work, giving me
a Syntax error: "(" unexpected. It is supposed to remove all files / directories except for that.
#!/bin/sh
object=$2 #sets item not to remove as second argument
address=$1 #sets... |
The extglob syntax for bash is not enabled by default, and that's what will give you the !(...) syntax. You'll have to turn it on if you want, by first changing your shebang to use bash
#! /bin/bash
then by turning on extglob by adding
shopt -s extglob
somewhere before that line
| Remove all objects in repo but specified object |
1,593,423,671,000 |
While cloning git repository I am getting the following error
Failed to connect to github.com port 443:Network is ureachable while I am able to clone on my windows machine
Edited-
git clone https://github.com/Rishav09/Mywebsite.git
I am getting the following error
Cloning into 'Mywebsite'...
fatal: unable to acce... |
Is there a firewall/proxy in place restriciting access?
Can you clone via SSH (note: you'll need a GitHub account and need to add your public SSH key to your profile to be able to SSH in).
git clone ssh://[email protected]/Rishav09/Mywebsite.git
| Unable to clone git repository on ubuntu [closed] |
1,593,423,671,000 |
I'm currently trying, for fun, to build a package management system (similar to apt / yum / zypper, etc...) using the git revision system, and I' searching for a way to know what is the latest stable version of the current branch.
Example : the Linux kernel
I would like to know, from the 3.18 branch, what is the late... |
There might be a simpler variant, but the following will get you the commit SHA-1 of the last commit to the master branch:
git show -s origin/master
(assuming your remote is called origin in your local repository).
If you only want the commit,
git show -s origin/master | awk 'NR == 1 { print $2 }'
To make sure you'r... | get the tag of a git branch |
1,593,423,671,000 |
I'm trying to deploy my sites on my company's semi-managed vps server using this tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps
It works on my own Digital Ocean servers without change, but things are set up differently on my company server.
The public_... |
I would do away with find; since you know where the directory is, you should just deal with it directly. The find command introduces a new condition that could fail.
In either case, you are not terminating the find command, which could be a problem.
This might work better:
#!/bin/sh
# REPLACE foo WITH ACCOUNT USERNAM... | I'm trying to deploy with git to a semi-managed vps, need to write a script to change owners |
1,598,865,843,000 |
I could copy the archive to the server from local using:
scp forum.tar.gz root@servername:/root/
However, when I tried to send from server to the local
[root@iz2ze9wve43n2nyuvmsfx5z ~]# scp draft.md root@localhot:/
ssh: Could not resolve hostname localhot: Name or service not known
lost connection
How could I get t... |
ssh: Could not resolve hostname localhot: Name or service not known
First, you've misspelled localhost.
Second, in this command, localhost means the host the scp command is currently running on.
If you use
scp forum.tar.gz root@servername:/root/
to copy a file from the current directory on the local system to /roo... | Scp remote files to the local [closed] |
1,598,865,843,000 |
Git has its own versions of commands such as mv and rm that we really ought to use when doing these operations inside repositories.
However, I'm sure I'm not the only person who often forgets to do this.
Is there any way to automatically use these tools when operating within a git repository?
I'm interested in answers... |
I suggest you have some myrm / mymv script that git rev-parse in order to detect if you are inside the repo and act accordingly. Something like :
ingitr="$(git rev-parse --is-inside-work-tree 2>/dev/null)"
if [ "$ingitr" ]
then
git rm $1 ( git mv $1 $2 )
else
rm $1 ( mv $1 $2 )
fi
Of course this is for a star... | Use Git Version of mv/rm etc When in Repository |
1,598,865,843,000 |
I want to create a Jenkins pipeline which runs GIT clone sanity every 5 minutes. how can I catch error/issue if the GIT clone command is not working/fails or passed?
|
The general approach is
if command; then
# Every went OK
else
# Something failed
fi
and it works for git:
if git clone ...; then
# The repo was cloned correctly
else
# Something failed
fi
The first branch is only taken if the git clone command exits with a status of 0, indicating success; any other e... | Create sanity for GIT clone |
1,598,865,843,000 |
I did this (was trying to set an 'self' alias with -v):
git() { if [[ $1 == "commit" ]]; then command git commit -v; else command git "$@"; fi; }
git() { if [[ $1 == "commit" ]]; then command git commit -v; else command git "$@"; fi; }
git() { git commit }; )
git() { git commit; }
git() { git (); }
git() { ... |
You sound really confused.
All those function definitions you ran were in the shell. If you ran them directly from the command line, then they only affect the current running shell environment. So if you had just closed the terminal and started a new one, the definitions would have been lost, and everything would be b... | my git is messed up for all commands, how can I fix it? |
1,598,865,843,000 |
Usually the way I do renames to make sense for myself is -
$ git clone <remote URL.git>
$ mv remotedir nameIwant
I was wondering if there is a better way to do it.
The reason is sometimes I wanna try some of the forks and wanna keep the main repo. as pristine and the forks also renamed from where they came from.... |
Try specifying the desired name of the target directory after your command, e.g.,
git clone <remote URL.git> nameIwant
From man git-clone:
<directory>
The name of a new directory to clone into. The "humanish" part of
the source repository is used if no directory is explicitly given
(repo for /path/to/rep... | how to rename a remote repo name so that it makes sense to you while git cloning [duplicate] |
1,598,865,843,000 |
Question in the title, but let me detail more. Excluding the ID/Password method on git CLI, we generate a SSH key and add the public key to the remote server. Why don't we have SSH-less public-key cryptography methods? We are not even connecting to remote a machine's terminal, we don't even need to connect a remote ma... |
As one StackOverflow answer says (mentioned in a comment), early in Git's history the ssh protocol had the benefits of supporting both read and write access to the backend repo, as well as cryptographically strong authentication and encryption.
Another benefit of ssh is it allows managing/replacing the keys independen... | Why git authentications works through SSH keys? |
1,598,865,843,000 |
For learning the inner-workings of Git, I wanted to compute commit hashes manually as described by this SO answer.
However, while printf works (see below), I get strange behaviour with echo, which outputs spaces before the command substitution.
Why does echo put embed those spaces in the output?
Incorrect (echo):
$ (e... |
wc -c outputs spaces before the number:
$ wc -c <file
6
In your first command, the string commit and the output of wc -c is kept within o double quoted string.
In your second command, the output of wc -c is use unquoted.
In an unquoted context, the shell would split the output on the characters in $IFS, which ... | Why does `echo -ne "commit $(git cat-file commit cc540cb | wc -c)\0"` outputs spaces before command substitution? |
1,598,865,843,000 |
I have a git server i have stood up. It is a basic one with all the remote repositories stored under
/mygit/repo/
I can push and pull and all the other git stuff using this ssh syntax
ssh://git@myserver/mygit/repo/proj.git
However due to circumstances i need to be able to do the same using this ssh syntax
... |
Alrighty i managed to work out the answer. Everything needs to be done as root for the chroot jailed git repo to work.
So the first thing to do is to setup a chroot jail directory
/git/server/repos
This handy guide shows how the process is done https://www.tecmint.com/restrict-ssh-user-to-directory-using-chrooted-... | Git Server Binding Directory To Port |
1,598,865,843,000 |
Terminals like Terminator or Guake terminal are not able to parse prompt profiles for git which is set in .bashrc file. PS1 variable is not set for terminals which use xterm as base which guake and terminator terminals use.
So if custom functions are used for instance for displaying custom path if current directory is... |
I figured out the solution, it was with .bashrc file in my home directory.
If we Open this file in text editor, here we will find a line where it's checking if the current terminal is xterm or not and setting some value to it:
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1=... | Terminals like Terminator or Guake terminal are not able to parse prompt profiles for git which is set in .bashrc file |
1,598,865,843,000 |
Easy question right? Just bare with me here..
I usually use Git to work with files on my local machine. I like this method because I can later check the files out on the shared drive for other non-git users to use. It is great because I can delete files (clean up) in my local directory and that cleans up remotely. ... |
Not to say there isn't a solution to this (although I don't know what it is), but, vis. "surely this must be a common task" -- probably not, because you are using the tool for a purpose it was not intended for.
git is a version control system, not a filesystem sync daemon or something. People doing VCS stuff are no... | Trying to improve a sync to a shared drive |
1,598,865,843,000 |
I've accidentally created two branches for my Git repository: main and master, which I now need to merge.
However, when using ls on the command line while checked into main branch, some files on my computer don't show up (files that don't exist in the main branch on GitHub). When I use git checkout master the files "r... |
Git is not "hiding" these files from you, it is just that these files are only on the "main" branch. If you want just one branch with all your files, you can merge these branches by typing git merge master while you're checked into main.
If you want to learn more about how git's branches work: https://git-scm.com/book... | Is Git hiding files on my computer? |
1,598,865,843,000 |
I am able to get the file difference using git diff command and I got it filtered like below:
-This folder contains common database scripts.
+This folder contains common database scripts.
+
+
+
+New Line added.
However I want to be able to get only the difference that is the line New Line added. how can I achieve th... |
Try This:
If +New Line added. is the last line of the output of git diff:
git diff | tail -1 | tr -d '\n'
If you want to get rid of +
git diff | tail -1 | sed -e 's/^+//' | tr -d '\n'
| Filter the below text using shell commands |
1,598,865,843,000 |
While trying to start apacheds.service I am getting error like apacheds is not loading properly
|
The package has not been installed correctly. You can try to fix the installation with:
sudo apt-get -f install apacheds
You also have the option to reinstall it:
sudo apt-get remove apacheds
sudo apt-get install apacheds
Or just reconfigure it:
sudo dpkg reconfigure apacheds
Depending on the result of these comman... | Apacheds unable to start [closed] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.