How do I cancel cloning a Git repository from Git Bash?

10,771

Ctrl+C should send a SIGINT or similar (signal for graceful exit) to the git process; if this does not help you can issue a SIGQUIT with Ctrl+\; last but not least you can always kill the process using the Windows Task Manager.

The directory you're cloning into may not be in a consistent state as a result of killing the git executable so you may wish to delete it before attempting to clone again, if git doesn't do so for you. When you try again, you can use the flag --depth=N to fetch only the last N commits.

Share:
10,771
Stevoisiak
Author by

Stevoisiak

Active programmer specializing in Python, SQL, C++, Java, and AutoHotkey. My goal is to make technology simpler to use by solving problems before users encounter them. That includes making easy-to-maintain code for anyone I collaborate with. (He/Him)

Updated on June 14, 2022

Comments

  • Stevoisiak
    Stevoisiak almost 2 years

    I am currently using Git Bash to clone a large repository that has over 100,000 commits. The cloning process has been going on for over half an hour, and it still hasn't finished receiving objects.

    Is it possible to cancel a git clone command from Git Bash?

    (For reference, I am using Git 2.17.0 (64 bit) on Windows 7 Professional).

    • Dai
      Dai almost 6 years
      Press Ctrl+C.
  • torek
    torek almost 6 years
    On Unix-ish systems, control-C sends SIGINT. Does Windows really send SIGTERM? That's rather unfriendly...
  • nanofarad
    nanofarad almost 6 years
    @torek Apologies, this was a typo on my part that I've since corrected. Git Bash on Windows behaves sufficiently close to real Bach on "real" Linux/Unix as to have similar behavior.
  • torek
    torek almost 6 years
    Ah, OK. Note that if git clone gets interrupted it should clean up after itself and not leave an inconsistent-state partial clone, but if you use stronger kill methods, it may not be able to do so.