Questions tagged [git]

Git is a free & open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Filter by
Sorted by
Tagged with
6
votes
2answers
23k views

Storing username and password in Git

When I do git push I get the command prompt like Username for 'https://github.com': then I enter my username manually like Username for 'https://github.com': myusername and then I hit Enter ...
29
votes
3answers
2k views

How did the Linux Kernel project track bugs in the Early Days?

We all know that Linus Torvalds created Git because of issues with Bitkeeper. What is not known (at least to me) is, how were issues/tickets/bugs tracked up until then? I tried but didn't get anything ...
0
votes
1answer
27 views

How can I search terminal output?

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 ...
1
vote
1answer
18 views

Can I safely git/commit/push or rsync a file being currently written by tee without breaking any pipe?

I have a pipe working for several days and writing some scientific results at a very low rate (a block of about 20 lines once an hour); most of the time, nothing is written. The file is written by tee....
2
votes
1answer
886 views

allow user access via ssh to /var/www/

Context: I am creating a gitolite3 hook for a specific repo, which contains some logic and css foo of my website. so what essentailly happens is Content under /var/www/nginx/ looks like: drwxrwxr-...
9
votes
4answers
36k views

git push fails with remote: error: hook declined to update refs/heads/master

I'm recently trying to start my own project on a community git repo, and I've been having some complications. I'm new to git, but here's what I've been trying to do to just test it. I run the ...
2
votes
1answer
55 views

Cannot su into root default shell - Debian

I am using a Debian 9 server. Usually I access via ssh to a normal user (say user1) and su into root, because I disabled ssh into root. Lately I was setting up a git-server where I created a user git ...
12
votes
1answer
13k views

Git pull in a Linux environment changes the owner of the files

Why will every time I execute a git pull on my live server, the owner of the files be changed? I keep on manually doing a chown john:john index.php. What do I need to change so that, when I do a git ...
1
vote
2answers
2k views

pass answer to git command

I try to get "git pull". It is asking for username and password. How i can automate it? ➜ git:(master) git pull Username for 'http://127.0.0.1': username Password for 'http://username@127.0.0.1': ...
1
vote
0answers
40 views

git ssh to ipv6 address on non-standard port

I am trying to access a git respository at a IPv6 address that has a SSH server listening on port 1111(for example). Access is controlled by SSH key and I can open a SSH session on the gitserver ...
3
votes
1answer
52 views

Comparing exit code: unary operator expected [duplicate]

I have a list of git commits in a .txt file and I want to iterate over the commits. For each COMMIT_ID I want check them using a git command whose exit code is 0 or 1. Depending on the result I want ...
1
vote
2answers
60 views

backup - can I use git to backup /etc? [duplicate]

I am using mac, and /etc is just a symlink to /private/etc, which contains hundreds of (important) configuration files, and the total size of /private/etc directory is smaller than 1 MB. Is it a good ...
0
votes
0answers
31 views

Why does git clone prompt for 'passphrase for key' when I SSH to my machine as my user?

I am running Ubuntu 16.04. When I am logged in normally and I run a git clone it works without issues - wesley@localhost:~/Temp$ git clone ssh://git@xyz.pqr.com:5678/abc/myproject.git Cloning into '...
0
votes
1answer
23 views

get all git remote.origin.url from exisiting clones in sub directory

i like to write a oneliner which gets me all remote url from my cloned repositories underneath my git_repo folder (personal git root folder) and to pipe into a file my idea was something like cat */....
0
votes
2answers
42 views

Print all subdirectories in the current directory that do not contain a .git

I'm trying to write a bash line that will look at all the subdirectories in my current folder and tell me if any do NOT contain a ".git". Pseudo: for subdir in currentdir if .git does not exist ...
1
vote
1answer
29 views

How to properly solve “git-gui: command not found” on Arch Linux?

The Arch Linux git package installs git-gui under /usr/lib/git-core/. This means git-gui cannot be launched directly from the terminal without specifying the full path: $ git-gui bash: git-gui: ...
9
votes
4answers
21k views

Unmet dependencies while installing Git on Debian

I am attempting to install git on Debian 8.6 Jessie and have run into some dependency issues. What's odd is that I didn't have any issues the few times I recently installed Git in a VM while I was ...
1
vote
0answers
50 views

Git add, commit, push from bash script

I'm trying to write a simple cron job that will keep my org-mode files in sync with a GitHub repo by committing every now and then. For some reason, it always manages to commit the files, but even ...
1
vote
1answer
36 views

Define git aliases based on gitconfig in zsh

I have the following lines in my ~/.aliases: function __function_exists() { declare -f -F $1 > /dev/null return $? } # git aliases (need to have git bash completion installed) for al in `...
1
vote
1answer
622 views

git 1.9 and yum groupinstall “Development Tools”

I was reading that installing unofficial repositories in RedHat was not a good idea. So I was trying to install NodeJS on the RH Server and I saw that the git version was 1.7.1. Our team is using 1.9 ...
-1
votes
2answers
38 views

“Filename” vs “Filename-git”

What is the meaning of files that end in -git? For example, I searched in a Terminal for "xcb-imdkit" then pressed tab. xcb-imdkit comes up, as well as "xcb-imdkit-git".
1
vote
0answers
43 views

Why was every .git folder on my system modified?

I ran my semi-regular rsync backup on my personal laptop to an external drive today, and I noticed many .git/ folders had their backups updated, presumably because they were all modified. However, ...
25
votes
6answers
63k views

Is it possible to clone only part of a git project?

I found a collection of slackbuilds, some i need there are on GitHub. https://github.com/PhantomX/slackbuilds/ I don't want to get all git. git clone https://github.com/PhantomX/slackbuilds.git But ...
2
votes
1answer
212 views

error `bash: prompt_git` report when no git operations performed

I occasionally encounter such an error: $ which bash /usr/local/bin/bash bash: prompt_git: command not found The report is obscure, since I did not manipulate git. When it's rebooted, the error ...
1
vote
1answer
1k views

branch name in Jenkins regular pipeline job

For a Jenkins pipeline job having web-hook trigger in Git/Bitbucket, each repo push triggers pipeline job. How we can know branch name in pipeline job on which push/change is committed. I need this ...
0
votes
1answer
90 views

Unable to access GitHub; Couldn't connect to server

I've been trying to clone a git repository (several, actually) and I'm getting the following error: fatal: unable to access 'https://github.com/repository-name': Couldn't connect to server My ...
4
votes
1answer
26 views

git return filtered repo to original parent

I want to reverse a git filter-branch and want to know the best way to do this. Originally I had a repo like this : A p q r I then made q its own repo so that I had this: A p r Q Now,...
21
votes
3answers
31k views

How to fix “Hunk #1 FAILED at 1 (different line endings)” message?

I am trying to create a patch with the command git diff sourcefile >/var/lib/laymab/overlay/category/ebuild/files/thepatch.patch when I apply the patch, it gives me $ patch -v GNU patch 2.7.5 $...
1
vote
2answers
66 views

Have custom grep exclude dirs for each project

I'm curious if anyone has a way to automatically generate a different set of --exclude-dir flags for grep for each different codebase that you work in. Because in one project, I'll never want to ...
1
vote
1answer
25 views

Git package breaks bash-completion?

I am about to try and install the git package. In Synaptic, in the dependencies tab, it writes: Breaks: bash-completion (<1:1.9-1) Breaks: bash-completion [italicized] I have the latest version ...
1
vote
3answers
32 views

How can I eliminate untracked files from find output?

I want to find within my project directory, but I'm only looking for files that are tracked by Git. Is there a command I can use as a filter for the find output (or any other means) to limit the ...
4
votes
3answers
1k views

How to avoid using 'ssh-add ~/.ssh/id_rsa' for every push to a github repo?

I have to repeatedly enter the following terminal commands in order to be able to push to a remote github repository. If I push to github, and then code some more for the next few hours before pushing ...
1
vote
1answer
53 views

Tmux crashing tty_clamp_area

using tmux as my dev environment. I have a standard split with vim on top, a three panes bellow that, one running npm start, one running the nodejs backend and the other one for stuff like git status. ...
0
votes
0answers
21 views

Why is stdin closed in Git hooks?

Based on how to prompt a user from within a Git hook it looks like stdin is closed by default within Git hooks. What is the reason for this behaviour? It's causing problems both with commands no ...
0
votes
1answer
2k views

Compile Git to use OpenSSL library libssl.so.1.0.1

Running a system that only has full support for OpenSSL version 0.9.8. Installed in parallel is OpenSSL 1.0.1 libraries (Supported by Distro) Git still preferentially uses the 0.9.8 libraries but we ...
0
votes
2answers
1k views

Git clone from Bitbucket

I am trying to git clone a repo off of bitbucket. I use git clone {https} temp. This gives me an error of refs not found. The https address is the one I get off of bitbucket, but the one they provide ...
30
votes
1answer
7k views

git-upload-pack hangs indefinitely

I have the following call structure: Jenkins runs fab -Huser@host set_repository_commit_hash:123abc. set_repository_commit_hash runs git fetch with pty = False. The child process ssh git@github.com ...
0
votes
0answers
101 views

How to put secure password in Jenkins Groovy parameter script

My overall goal is to create a build parameter in Jenkins which is a drop down for only release branches. I have been at this for some time and know there are many ways to do this. Let me run through ...
1
vote
1answer
31 views

Why does executing `git status` change the result of subsequent `git diff-index`?

consider: $ git --version git version 2.20.1 (Apple Git-117) $ git diff-index --quiet HEAD ; echo $? 1 $ git status > /dev/null $ git diff-index --quiet HEAD ; echo $? 0 This is on macos with a ...
1
vote
2answers
72 views

How to keep my system clean?

When I work on a project I often need to install a bunch of packages and libraries/tools. Often these packages create logs files and other kind of useless files that I will not need when the project ...
0
votes
1answer
28 views

git remove from repo history a large subdirectory that was removed several commits ago

This repository had a large subdirectory of large files that months ago I removed from the commit and that I now want to remove from the repo forever. The massive subdirectory is no longer in the ...
0
votes
1answer
82 views

Is NixOS configuration gittable?

Long story short: I've used only distributions with "imperative configuration management/packaging" approach, so far. And,... I'm annoyed by hard to trace breakages/issues with imperative ...
0
votes
1answer
76 views

How to use zsh tab completion on Git without origin?

I am using zsh with oh-my-zsh on Ubuntu 18.04.2. Currently, Git is installed at version 2.20.1. Whenever I want to push a local branch to a remote (origin) I try to use the tab completion in the ...
0
votes
3answers
30 views

trouble with two delimiters in awk

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 ...
0
votes
0answers
33 views

How to install git repo using apt-get?

I want to install my new git hub application to system using command like apt-get install <application_name> rather than cloning git repo and compiling and moving the file to /bin/folder.
1
vote
2answers
42 views

Capture git output into variable

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 ...
63
votes
5answers
159k views

Creating an user without a password

I'm trying to create user without password like this: sudo adduser \ --system \ --shell /bin/bash \ --gecos ‘User for managing of git version control’ \ --group \ --disabled-password \ ...
1
vote
1answer
69 views

git-annex created a monster that I cannot un-init

I was going to explore git-annex, but it turns out it doesn't do what I need. That would be fine except that I initialized it on a repository that I'm using (stupid, I see that now) and now all my ...
0
votes
0answers
23 views

How to efficiently track .bashrc (and similar) with git? [duplicate]

I would like to keep my .bashrc file in a gitlab repo, for obvious reasons. However, it sits in my home directory. Initialising a git repo in my home repo seems unweildly, as it then looks at ...
2
votes
2answers
3k views

Git asks for password when using SSH URL, ssh does not

I have three servers (two ubuntu 16.04, one mac mini) and several macbooks. One server ubuntu is for gitlab and the other is an internal site server. The mac mini is running a CI. Recently the ...