1

So, I migrated to a new system, and for that, I created an SSH key to add it in GitHub for pull, push, and clone. For Android Studio and other projects, everything seems to work fine so far. But as soon as I integrated a flutter project, cloning started taking forever and after cloning I am not able to push anything. It fails with the below error,

Delta compression using up to 12 threads
fatal: the remote end hung up unexpectedly
client_loop: send disconnect: Broken pipe
fatal: the remote end hung up unexpectedly

I tried almost everything that I could find online similar to mine, but none seems to be working for me.

  1. Tried to increase the buffer size
  2. Tried creating a new SSH key just in case if that would work but nope it didn't
  3. Tried clearing garbage collector
  4. Tried setting up git username and email address and then doing a push
  5. Tried from GUI like sourcetree still same error.
  6. Here is one of the links which I followed as well but no luck. link is here

Appreciate any help!

NOTE: One thing I wanted to update, as I am running from two systems currently, my GitHub account has two SSH keys. Can it create an issue because of that? should I disable the previous one? Or it's not an issue to keep two SSH in the same account.

Darpal
  • 352
  • 5
  • 20
  • "Or it's not an issue to keep two SSH in the same account" That should be fine. It's quite normal to have a different ssh key for each machine. – matt Jul 24 '21 at 19:46

1 Answers1

1

As mentioned in "Using Dart & Flutter Packages from a Private Git Repo" from Jethro Lorenzo Garcia Lising, make sure you you can clone the remote repository which cause issues.

Check the right SSH key is used (and I woudl recommend, for testing, to use a passphrase-less private key, to avoid issues with ssh-agent)

GIT_SSH_COMMAND='ssh -Tv'
git clone ...

That will help show you what key is issues, and if there is a problem resulting from said key usage.


The OP Darpal Dhyani adds in the comments:

Somehow my issue was with my GitHub project.
Repository was wayyy too big :) which was creating issues for me just for pushing.

Flutter creates too many build files and cache files so created a .gitignore (which I did not do before): Resolved my issue.

Here is an example of Flutter project .gitignore.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Hi Von, I went through the link which you shared with me above. It tells to add some lines to ```.ssh/config``` file. But the weird thing I am seeing is somehow I don't see any config file in .ssh directory. Is that any issue with my system? – Darpal Jul 25 '21 at 19:12
  • @DarpalDhyani No, no issue: this is expected. There is no `config` file by default in `~/.ssh`. You can add one, and a `ssh -Tv` session will show that SSH is detecting that "`config`" file, and will use its content. – VonC Jul 25 '21 at 20:30
  • I am sorry if I am taking this too long for you, I am very new to this ssh key thing. I wanted to confirm that I need to add ```ssh -Tv``` inside that config file? Or follow the commands that were given in that link? I tried following that link, it started giving me different error "You dont have permission to access this repository" – Darpal Jul 26 '21 at 01:59
  • 1
    @DarpalDhyani ssh -Tv is to be added in command line, or in the environment variable as mentioned in the answer. And if you want to use a config entry, don't forget to test it with `ssh -Tv `: The entry is a shortcut for `ssh -i /my/private/key git@github.com` – VonC Jul 26 '21 at 06:31
  • thanks, @VonC for your help!! Somehow my issue was with my GitHub project. Repository was wayyy too big :) which was creating issues for me just for pushing. Flutter creates too many build files and cache files so created a gitignore (which i didnt do before) Resolved my issue. – Darpal Jul 27 '21 at 17:42
  • @DarpalDhyani Well done. I have included your comment in the answer for more visibility, as well as an example of a `.gitignore` for Flutter projects. – VonC Jul 27 '21 at 20:54