Git is an open source distributed version control system originally designed and written by Linus Torvalds. It is generally used to keep track of source code for software projects. As a DVCS, Git provides powerful help with branching, merging, and distributed development.

learn more… | top users | synonyms

99
votes
3answers
84k views

Tell git which private key to use

ssh has the -i option to tell it which private key file to use when authenticating: -i identity_file Selects a file from which the identity (private key) for RSA or DSA authentication is ...
97
votes
9answers
167k views

How can I roll back 1 commit?

I have 2 commits that I did not push: $ git status # On branch master # Your branch is ahead of 'faves/master' by 2 commits. How can I roll back my first one (the oldest one), but keep the second ...
93
votes
9answers
71k views

How do I ensure Git doesn't ask me for my GitHub username and password?

I am working with a repo on GitHub and everytime I try to push something, it asks for my GitHub username and password. I don't want it doing that. I tried the instructions on setting your email in ...
70
votes
12answers
43k views

How to get git-completion.bash to work on Mac OS X?

I have followed http://blog.bitfluent.com/post/27983389/git-utilities-you-cant-live-without to add git-completion.bash to my /opt/local/etc/bash_completion.d/git-completion and I put ...
61
votes
4answers
17k views

Forward SSH traffic through a middle machine

SSH tunneling is very confusing to me. I am wondering if I can do this in Linux. I have 3 machines.. A. My local machine at home. B. Machine at work that I can SSH into (middle man). C. My desktop ...
60
votes
3answers
45k views

Using Multiple SSH Public Keys

I have a personal account and a company account on Unfuddle. On Unfuddle SSH keys can only be used on a single account, so I need to create a seperate SSH key on my laptop for both accounts. I ran ...
46
votes
2answers
12k views

Git Bash Here in ConEmu

How do I create a right-click context menu entry to open Git Bash at a given folder within ConEmu? See Git Bash Here in Console2 for the equivalent question for Console2.
42
votes
5answers
53k views

How to reset master to origin/master?

Can I do following in a simpler way? git checkout origin/master git branch -D master git branch master git checkout master
41
votes
4answers
11k views

Git Bash Here in Console2?

MSysGit installs a context menu item that opens a Git Bash prompt at the currently selected folder; however, this opens a cmd.exe window and I would like it to open in Console2 instead. What ...
39
votes
8answers
41k views

How should I set the PATH variable on my Mac so the Hombrew-installed tools are found?

Trying to set up Homebrew on a new Mac (on previous Macs I would install packages from source). The first package I tried to install was Git: $ brew install git Installation went OK, but which ...
38
votes
2answers
19k views

Git - List all files currently under source control?

Is there a way to list all files currently under source control in git? (Not just those that have been modified).
33
votes
1answer
26k views

GIT merge master into a branch

I have been developing a new feature on a new branch, on the side I have committed quite a few changes on my master branch. I would like to know if it's possible to merge the master branch in my new ...
28
votes
3answers
7k views

Tmux and ZSH custom prompt : bug with window name

I have customized my ZSH prompt with oh-my-zsh to make it more readable and add information about git if I'm in a repository. Example : bob@inf [~/docs] % bob@inf [~/src/nicest] master % (in a git ...
28
votes
5answers
11k views

Can you specify git-shell in .ssh/authorized_keys to restrict access to only git commands via ssh?

I'd like to be able to use a ssh key for authentication, but still restrict the commands that can be executed over the ssh tunnel. With Subversion, I've achieved this by using a .ssh/authorized_keys ...
25
votes
5answers
13k views

Can not clone any git repository from github

Since the update to OS X 10.9.2 I am not able to clone any git repository from github.com If I run the git clone command I get the following error: git clone ...
25
votes
3answers
8k views

git “ping”: check if remote repository exists

I'd like to know whether a remote repository exists. Here's what I came up with: git ls-remote "$REPO_URL" &> /dev/null Is there any better way?
23
votes
2answers
8k views

Can't remove remote branch in git

I'm trying to remove a remote branch with git: rpinson@rpinson:~/dev/charismanie$ git remote show origin * remote origin Fetch URL: git@github.com:raphink/Charismanie.git Push URL: ...
22
votes
8answers
26k views

git push fatal failed

I somehow deleted the whole directory of my code branch. I cloned a new one. It worked fine except pushing. ~/workspace/wtf (mybranch)]$ git push origin mybranch error: Cannot access URL [my url], ...
22
votes
10answers
24k views

How to upgrade Git on Ubuntu Hardy?

I have Git version 1.5.4.3 installed, but I think this must be an old version. I'm running Ubuntu Hardy 8.04. I need to install at least version 1.6 to get a Git GUI to work. How do I upgrade my ...
22
votes
3answers
26k views

Install Git under OSX Mavericks

I've just completed a fresh install of Mavericks. Then I went to git-scm.com and downloaded the Mac installer and installed Git from that. Now whenever I go into the terminal and type git I get this: ...
22
votes
1answer
31k views

Terminal Command To Find What Version Of Git I Have Installed?

What is the terminal command to find what version of Git is currently installed on my system?
18
votes
2answers
12k views

Why can't I push an empty commit?

git commit --amend --allow-empty then git push origin master the git said that ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'remoteurl' To ...
17
votes
4answers
15k views

I can't uninstall Git

I was researching Git so I downloaded the Windows version to test it out on a repository on GitHub. After about 30 minutes I couldn't work out how to use it, so I decided I probably wouldn't need a ...
17
votes
2answers
2k views

Is there a git-like file system?

Git stores content uniquely in its repo based on the calculated hash of any file. Thus, if my directory has two copies of the same file somewhere inside it, git will only actually store it once. I ...
17
votes
1answer
9k views

Git vs. Portable git

I don't do my system reinstalls that often, and the last time I looked there was only "regular" git on the download list. Now I see they pushed out the portable variant as well ... only I haven't been ...
16
votes
3answers
25k views

How do I disable password prompts when doing git push/pull?

Every time I want to push and/or pull from the terminal (in Linux) I have to enter a password. How do I remove this so that it pulls and/or pushes without the password?
15
votes
4answers
7k views

How to amend the last commit to un-add a file?

I have modified two files a, b in the last commit. But file b should not be commited, what's the workflow to amend this?
15
votes
3answers
3k views

How can I enable colored output for OSX diff?

I need to diff two files (not two versions of the same file, they are however tracked by git, but that is unrelated) and I would like some colored output, how can I achieve that? $ diff file_1 file_2 ...
15
votes
2answers
4k views

How can I Resync a fork from original

I just forked a project in Github. I made modifications and sent a pull request. The owner merged my fork with the main project and after that he made some modifications. So for now my fork is not ...
15
votes
1answer
4k views

Which fork of GitX is the most active? [closed]

I've been using the original GitX but I've noticed it hasn't had any updates for quite a while. Which version of GitX is the most active, in terms of updates/stability/features? The original ...
14
votes
2answers
15k views

How do Git branches work? Can I remove the master branch?

I have a project that has 2 branches, development and production. I'm not using the master branch and each time I write git status it tells me how far ahead my branch is from the master. When I try ...
14
votes
2answers
22k views

How can I push a Git repository to a folder over SSH?

I have a folder called my-project inside which I've done git init, git commit -a, etc. Now I want to push it to an empty folder at /mnt/foo/bar on a remote server. How can I do this? I did try, ...
14
votes
3answers
14k views

Pull for another Git branch without switching

we recently switched from SVN to Git and at the same time put our live systems into version control (instead of local checkout and file copy to live). On the project i'm assigned to we all access ...
14
votes
1answer
17k views

Is there way to list all existing repositories using git?

In order to clone a git repository one must have the name of the repository. When working with many repositories it can be hard to remember all the different names, so now I'm wondering if there is ...
14
votes
1answer
384 views

EGit (Eclipse) wrongly interpreting file names with non-ASCII characters?

I recently switched to using a Git repository within Eclipse (Juno SR2), using EGit. In our project, some file names contains umlauts and other special non-ASCII-characters. On the command line, git ...
13
votes
4answers
8k views

Using git through cygwin on windows 8

I've got a windows 8 dev preview (not sure if it's relevant, but I never had this hassle on w7) machine and I'm trying to clone a git repo from github. The problem is that my ~/.ssh/id_rsa has 440 ...
13
votes
5answers
22k views

How do I backup a git repo?

I am planning to switch from SVN to git. With svn I just copy my repo folder when I want to back it up. However git doesn't have one so what do I do? Should I create a clone on a separate drive and ...
13
votes
2answers
7k views

Git on Mac: How to set Nano as the default text editor?

When I'm using Git on Mac and need to do a rebase, the Vim editor kicks in by default. I would prefer Nano – could someone please explain how to reconfigure Git to make it use Nano for rebase? Thank ...
13
votes
1answer
6k views

git: how can i config git to ignore file permissions changes

I have some git projects in a linux server. i use Mac and linux to do my programming. the problem is that the mac filesystem's permissions doesn't really work well like in linux so all the files ...
13
votes
2answers
1k views

How to turn on git syntax highlighting on vim on a Mac

I just recently switched over to Mac. On windows I was using git through the msysgit project. When doing a git rebase -i I'm used to get a nice syntax highlighting in vim. I'm missing it badly now ...
13
votes
9answers
4k views

Cygwin/Git Bizarre Terminal Issue

Alright, this is weird. First off, this is mintty running on up-to-date cygwin, with git pulled from cygwin's setup.exe. I am running zsh. $ git clone ...
13
votes
1answer
2k views

How to reuse/extend etckeeper's metadata engine for git control of non-/etc filesystems, or extend git natively with said capability?

Overview + question I want etckeeper-like filesystem metadata control for non-/etc, git-controlled directories. Home and web-app directories, among others, are classically sensitive to metadata ...
11
votes
5answers
2k views

How can I discard file change from fugitives status window?

When in the fugitive-plugin status window, accessed using :Gstatus, it's possible to diff changes for a file using D and toggle files for commit using -. Is there any similar shortcut for discarding ...
11
votes
3answers
41k views

Using GIT on Aptana 3 standalone

The only references I see to GIT in Aptana Studio 3 (the standalone version) are under preferences where the only field is to identify an executable (do I need to do that?) and importing a project, ...
11
votes
1answer
5k views

getting git colors in OSX terminal

I have just installed XCode and GitHub for Mac. I have successfully run "GitHub->Install Command Line Utility". I can connect to repositories with both apps and I can use the git command in the ...
11
votes
1answer
6k views

GitHub for Windows Install Error

I'm trying to install the GitHub for Windows that I downloaded from the GitHub site. However, I get the following error message: Application cannot be started. Contact the application vendor. ...
11
votes
3answers
12k views

Update git on mac

I can't remember how I installed git a while back....but now it's living in /usr/bin/git and needs to be updated. I don't care how (pre-compiled or build my own) but what I don't want is another ...
11
votes
2answers
2k views

Rewrite git history to replace all CRLF to LF?

I'm going to transfer a private Git repository from win32 box to Ubuntu. Though I can do a final dos2unix commit, but I'd like to rewrite the whole history, so some Git GUI will display log/diff ...
11
votes
2answers
691 views

How can I achieve separate colors for current, local, and remote ref names when using a custom git log format?

I have a custom git log format that I use. I have color.ui=true set in my .gitconfig. For example this simple format: git log --pretty=format:"%h %d %s" --decorate This would print something like ...
11
votes
2answers
5k views

Homebrew won't link git

When I installed git or upgrade git via brew I couldn't link it with brew link git. If I try sudo brew link git I get: cowardly refusing to sudo brew link It says that I have to check the ...