GIt: have to push twice (or more) - windows

I use git+ssh on win7 machine. When I type 'git push', it sometime send commit to server, and sometime not. And every time I can't understand, was it sended or not. Why it happends and what can I do to fix it?
D:\project>git push
Counting objects: 56, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (28/28), done.
Writing objects: 100% (29/29), 3.83 KiB, done.
Total 29 (delta 27), reused 0 (delta 0)
fatal: The remote end hung up unexpectedly
D:\project>git push
Counting objects: 56, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (28/28), done.
Writing objects: 100% (29/29), 3.83 KiB, done.
Total 29 (delta 27), reused 0 (delta 0)
fatal: The remote end hung up unexpectedly
D:\project>git push
Everything up-to-date

Related

Can't push a single CSS file with git

I've encountered this horrible error message when trying to push sometimes.
> git push
Enumerating objects: 14, done.
Counting objects: 100% (14/14), done.
Delta compression using up to 12 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (8/8), 215.75 KiB | 11.35 MiB/s, done.
Total 8 (delta 2), reused 5 (delta 0), pack-reused 0
send-pack: unexpected disconnect while reading sideband packet
Connection to github.com closed by remote host.
fatal: the remote end hung up unexpectedly
I had 5 or 10 files in my latest commit that I wanted to push, and I got this error. Through a lot of trial and error, I managed to push everything in separate commits, except for a single bootstrap css file. The file is only 216KB, so I doubt it's a file size issue. I also doubt it's a network issue because I have had no other internet connection problems in weeks, and have even been on zoom calls sharing my screen while this was happening.
Here's what my terminal looks like when I try to commit and push the file
❯ git status
On branch main
Your branch is up to date with 'origin/main'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
java/servers/coins-website/coins-react/src/bootstrap-yeti.css
nothing added to commit but untracked files present (use "git add" to track)
❯ git add .
❯ git commit -m "add bootstrap-yeti.css"
[main b618bc6] add bootstrap-yeti.css
1 file changed, 11245 insertions(+)
create mode 100644 java/servers/coins-website/coins-react/src/bootstrap-yeti.css
❯ git push
Enumerating objects: 14, done.
Counting objects: 100% (14/14), done.
Delta compression using up to 12 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (8/8), 215.76 KiB | 11.36 MiB/s, done.
Total 8 (delta 2), reused 5 (delta 0), pack-reused 0
send-pack: unexpected disconnect while reading sideband packet
client_loop: send disconnect: Broken pipe
fatal: the remote end hung up unexpectedly
The only thing that seems to work is cloning the repo, moving the file into the new local repo, committing, and pushing. But with that, I have to abandon my branches and stashes in the old repo. I've also had this same issue at work with a much much larger repository, so recloning and breaking up my commits every few days is making me lose my mind.
How can I fix this? Can I reset the .git folder without deleting my branches and stashes?

How to correctly clone --recursive git repository on Windows?

How to correctly clone --recursive git repository on Windows?
My git version is:
git --version
git version 2.8.2
When I clone a repository with --recursive using this command line:
git clone --recursive https://github.com/evandrocoan/SublimeTextStudio.git "D:/User/Dropbox/Applications/SoftwareVersioning/SublimeText/Data/Packages"
And this were the console output: (everything ok, without errors)
D:\User\Dropbox\Applications\SoftwareVersioning\SublimeText>git clone --recursive https://github.com/evandrocoan/SublimeTextStudio.git "D:/User/Dropbox/Applications/SoftwareVersioning/Su
blimeText/Data/Packages"
Cloning into 'D:/User/Dropbox/Applications/SoftwareVersioning/SublimeText/Data/Packages'...
remote: Counting objects: 827, done.
remote: Compressing objects: 100% (244/244), done.
remote: Total 827 (delta 139), reused 0 (delta 0), pack-reused 563eceiving objects:
Receiving objects: 100% (827/827), 3.64 MiB | 691.00 KiB/s, done.
Resolving deltas: 100% (452/452), done.
Checking connectivity... done.
Submodule 'ANSIescape' (https://github.com/evandrocoan/SublimeANSI) registered for path 'ANSIescape'
Submodule 'BBCode' (https://github.com/evandrocoan/BBCode) registered for path 'BBCode'
Submodule 'Boxy Theme' (https://github.com/evandrocoan/st-boxy) registered for path 'Boxy Theme'
Submodule 'Package Control' (https://github.com/evandrocoan/package_control) registered for path 'Package Control'
Submodule 'SideBarEnhancements' (https://github.com/evandrocoan/SideBarEnhancements) registered for path 'SideBarEnhancements'
Submodule 'SublimeAmxxPawn' (https://github.com/evandrocoan/SublimeAmxxPawn) registered for path 'SublimeAmxxPawn'
Submodule 'SublimeNotepadPlusPlusTheme' (https://github.com/evandrocoan/SublimeNotepadPlusPlusTheme) registered for path 'SublimeNotepadPlusPlusTheme'
Submodule 'SublimeTextToolBar' (https://github.com/evandrocoan/SublimeTextToolBar) registered for path 'SublimeTextToolBar'
Submodule 'Theme - SoDaReloaded' (https://github.com/evandrocoan/SoDaReloaded-Theme) registered for path 'Theme - SoDaReloaded'
Submodule 'Theme - Soda' (https://github.com/evandrocoan/soda-theme) registered for path 'Theme - Soda'
Cloning into 'ANSIescape'...
remote: Counting objects: 200, done.
Receiving objects: 3% (6/200)remote: Total 200 (delta 0), reused 0 (delta 0), pack-reused 200
Receiving objects: 100% (200/200), 45.36 KiB | 0 bytes/s, done.
Resolving deltas: 100% (120/120), done.
Checking connectivity... done.
Submodule path 'ANSIescape': checked out 'd93f5ce408a28252c73d11a5b0b1b456162e8bac'
Cloning into 'BBCode'...
remote: Counting objects: 86, done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 86 (delta 4), reused 0 (delta 0), pack-reused 74
Unpacking objects: 100% (86/86), done.
Checking connectivity... done.
Submodule path 'BBCode': checked out '51d4813dc2e7a99e2c8afa5ce1cf71bbebf1a88d'
Cloning into 'Boxy Theme'...
remote: Counting objects: 13403, done.
remote: Compressing objects: 100% (58/58), done.
remote: Total 13403 (delta 28), reused 0 (delta 0), pack-reused 13345
Receiving objects: 100% (13403/13403), 6.84 MiB | 410.00 KiB/s, done.
Resolving deltas: 100% (7243/7243), done.
Checking connectivity... done.
Submodule path 'Boxy Theme': checked out 'f5c8f1dd3f69df64ca0cd45dbd8f25456fc53e58'
Cloning into 'Package Control'...
remote: Counting objects: 4950, done.
remote: Compressing objects: 100% (73/73), done.
remote: Total 4950 (delta 43), reused 0 (delta 0), pack-reused 4877
Receiving objects: 100% (4950/4950), 1.73 MiB | 643.00 KiB/s, done.
Resolving deltas: 100% (3476/3476), done.
Checking connectivity... done.
Submodule path 'Package Control': checked out '5195e29c0a8e12913d1fb7aaaf1370942d7f2409'
Cloning into 'SideBarEnhancements'...
remote: Counting objects: 1506, done.
remote: Total 1506 (delta 0), reused 0 (delta 0), pack-reused 1506
Receiving objects: 100% (1506/1506), 468.76 KiB | 517.00 KiB/s, done.
Resolving deltas: 100% (940/940), done.
Checking connectivity... done.
Submodule path 'SideBarEnhancements': checked out '3c7957f2446b442931c3731358a79750687059d2'
Cloning into 'SublimeAmxxPawn'...
remote: Counting objects: 287, done.
remote: Compressing objects: 100% (123/123), done.
remote: Total 287 (delta 164), reused 282 (delta 159), pack-reused 0
Receiving objects: 100% (287/287), 149.52 KiB | 0 bytes/s, done.
Resolving deltas: 100% (164/164), done.
Checking connectivity... done.
Submodule path 'SublimeAmxxPawn': checked out 'df13519f98d3278fc025d01d3f39ff8ae2ff64a7'
Cloning into 'SublimeNotepadPlusPlusTheme'...
remote: Counting objects: 163, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 163 (delta 1), reused 0 (delta 0), pack-reused 157
Receiving objects: 100% (163/163), 33.82 KiB | 0 bytes/s, done.
Resolving deltas: 100% (65/65), done.
Checking connectivity... done.
Submodule path 'SublimeNotepadPlusPlusTheme': checked out '4cbca8d3717c4232ea4783579d82c45127623666'
Cloning into 'SublimeTextToolBar'...
remote: Counting objects: 48, done.
remote: Total 48 (delta 0), reused 0 (delta 0), pack-reused 48
Unpacking objects: 100% (48/48), done.
Checking connectivity... done.
Submodule path 'SublimeTextToolBar': checked out '04d97345937a9181b95c3b326ed1acc1bda60637'
Cloning into 'Theme - SoDaReloaded'...
remote: Counting objects: 1411, done.
remote: Total 1411 (delta 0), reused 0 (delta 0), pack-reused 1411eceiving objects
Receiving objects: 100% (1411/1411), 5.60 MiB | 424.00 KiB/s, done.
Resolving deltas: 100% (703/703), done.
Checking connectivity... done.
Submodule path 'Theme - SoDaReloaded': checked out 'ff9967a98734fc8f46e07bc7cb86115d325c9225'
Cloning into 'Theme - Soda'...
remote: Counting objects: 3156, done.
remote: Total 3156 (delta 0), reused 0 (delta 0), pack-reused 3156
Receiving objects: 100% (3156/3156), 5.70 MiB | 366.00 KiB/s, done.
Resolving deltas: 100% (1157/1157), done.
Checking connectivity... done.
Submodule path 'Theme - Soda': checked out 'd47df56b20741eda7ada4d1ed7e730bc4203b0d3'
D:\User\Dropbox\Applications\SoftwareVersioning\SublimeText>
All the sub-modules end up within a .git file, instead of a .git folder, containing its git info:
That .git file contents are:
gitdir: /cygdrive/d/User/Dropbox/Applications/SoftwareVersioning/SublimeText/Data/Packages/.git/modules/SublimeNotepadPlusPlusTheme
The file should probably be a Linux symlink, but worthless on windows. It is all absolute, a horrible thing as the Main repository folder is just one level above. It should be relative with ../.
On the folder Data/Packages/.git/modules/, I got all the submodules .git folders:
And when I open the master repository with Smartgit, it shows all my cloned sub-modules as not found:
Cygwin git prefers posix path, so instead of
git clone --recursive https://github.com/evandrocoan/SublimeTextStudio.git "D:/User/Dropbox/Applications/SoftwareVersioning/SublimeText/Data/Packages"
you should have tried:
git clone --recursive https://github.com/evandrocoan/SublimeTextStudio.git "/Cygdrive/d/User/Dropbox/Applications/SoftwareVersioning/SublimeText/Data/Packages"
The result has a .git folder.
Packages/.git
Packages/.git/hooks
Packages/.git/info
Packages/.git/logs
Packages/.git/logs/refs
Packages/.git/logs/refs/heads
Packages/.git/logs/refs/remotes
Packages/.git/logs/refs/remotes/origin
Packages/.git/modules
Packages/.git/modules/ANSIescape
Packages/.git/modules/ANSIescape/hooks
Packages/.git/modules/ANSIescape/info
Packages/.git/modules/ANSIescape/logs
...
Packages/.git/modules/Theme - SoDaReloaded/refs/tags
Packages/.git/objects
Packages/.git/objects/info
Packages/.git/objects/pack
Packages/.git/refs
Packages/.git/refs/heads
Packages/.git/refs/remotes
Packages/.git/refs/remotes/origin
Packages/.git/refs/tags
Packages/.githooks
Anyway as you were looking for a git repository compatible with a Windows application as SmartGit you need to use the Windows version of Git.
As you have already discovered.
Now removed that git, and installed this other https://git-scm.com/download/win:
git --version
git version 2.10.0.windows.1
It stills creating the .git file, but now the symlink contents are relative:
gitdir: ../.git/modules/ANSIescape
And it is being correctly detected by Smartgit.

Git push throwing error: GH001: Large files detected

I am pushing my Xcode project which written in Swift to GitHub. In this project I used GoogleMaps SDK for IOS and GoogleMaps framework integrated with few other frameworks which made this project heavy as I expected. particularly there is one file called GoogleMaps is over 100MB which is violating GitHub's policy thus I am getting below error.
C:\Users\Shyam Bhimani\Desktop\FindMyBuddy>git push
Git LFS: (0 of 0 files, 1 skipped) 0 B / 0 B, 34 B skippedCounting
objects: 691, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (597/597), done.
Writing objects: 100%
(691/691), 60.52 MiB | 384.00 KiB/s, done.
Total 691 (delta 161),reused 0 (delta 0)
remote: error: GH001: Large files detected. You may want to try Git
Large File Storage - https://git-lfs.github.com.
remote: error: Trace: a2d7f29c8861bcb6bd13498cfcd44ac3
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File
Pods/GoogleMaps/Frameworks/GoogleMaps.framework/Versions/A/GoogleMaps
is 123.08 MB; this exceeds GitHub's file size limit of 100.00 MB To
https://github.com/shyambhimani/FindMyBuddy.git ! [remote rejected]
master -> master (pre-receive hook declined)
error: failed to push some refs to
'https://github.com/shyambhimani/FindMyBuddy.git'
So far I have tried
Git lfs track 'Pods/GoogleMaps/Frameworks/GoogleMaps.framework/Versions/A/GoogleMaps'
git lfs track '*.*'
git lfs track '*.File'
However no luck It still gives me same error every time I push.
I do not know extention of that file so I tried *.* just in case if it works but it did not.
I would be grateful if anyone could help me to solve this issue. TIA
GitHub has a limit of 100MB unless you pay for Git LFS. Sadly there is no way to get around this unless you ignore files using .gitignore. But those files will no longer be tracked by git.
EDIT
Forgot to mention for your specific case especially with a common framework such as Google Maps it is very easy to re download that at a later date using CocoaPods. Personally I would ignore that whole folder in .gitignore because after you pull down your repo you can always re download it easily.

git clone hangs at "checking connectivity"

OS - Windows 7 professional 64 bit
GIT for windows - Git-1.9.0 - Using Git bash
I started having problems with "git fetch" suddenly out of nowhere.
Sometimes git.exe would error out and sometimes the "git fetch" would just hang.
So I decided to start everything from scratch.
I uninstalled git for windows and reinstalled it (accepting all defaults), restarted the machine. Created a brand new folder and did the following
$ git clone git#github.com:myid#example.com/myproject.git
Cloning into 'myproject'...
Enter passphrase for key '/c/Users/myid/.ssh/id_rsa':
remote: Counting objects: 287209, done.
remote: Compressing objects: 100% (86467/86467), done.
remote: Total 287209 (delta 188451), reused 287209 (delta 188451)
Receiving objects: 100% (287209/287209), 168.89 MiB | 328.00 KiB/s, done.
Resolving deltas: 100% (188451/188451), done.
Checking connectivity...
It consistently just hangs at "checking connectivity"
I have scanned the machine for viruses/trojans what have you and no threats were found.
This is happening both at work location and from home - So its probably not the internet.
I'm not sure how to proceed or what to try next.
I removed the known_hosts file from my ~/.ssh folder, which did the trick. Everything works now.
This message is not related to network connectivity. This is about checking whether every object is connected to an existing reference.
Detailed answer can be found on superuser
Try to run git with setting environment variable GIT_CURL_VERBOSE=1 to see what is going on.
This should improve with Git 2.34 (Q4 2021), where the code that handles large number of refs in the "git fetch"(man) code path has been optimazed.
See commit caff8b7, commit 1c7d1ab, commit 284b2ce, commit 62b5a35, commit 9fec7b2, commit 47c6100, commit fe7df03 (01 Sep 2021) by Patrick Steinhardt (pks-t).
(Merged by Junio C Hamano -- gitster -- in commit deec8aa, 20 Sep 2021)
fetch: avoid second connectivity check if we already have all objects
Signed-off-by: Patrick Steinhardt
When fetching refs, we are doing two connectivity checks:
The first one is done such that we can skip fetching refs in the case where we already have all objects referenced by the updated set of refs.
The second one verifies that we have all objects after we have fetched objects.
We always execute both connectivity checks, but this is wasteful in case the first connectivity check already notices that we have all objects locally available.
Skip the second connectivity check in case we already had all objects available.
This gives us a nice speedup when doing a mirror-fetch in a repository with about 2.3M refs where the fetching repo already has all objects:
Benchmark #1: HEAD~: git-fetch
Time (mean ± σ): 30.025 s ± 0.081 s [User: 27.070 s, System: 4.933 s]
Range (min … max): 29.900 s … 30.111 s 5 runs
Benchmark #2: HEAD: git-fetch
Time (mean ± σ): 25.574 s ± 0.177 s [User: 22.855 s, System: 4.683 s]
Range (min … max): 25.399 s … 25.765 s 5 runs
Summary
'HEAD: git-fetch' ran
1.17 ± 0.01 times faster than 'HEAD~: git-fetch'
You should execute "git prune".

How do I download a specific version of source code from android.googlesourcecode.com using Git?

I want to download the source code shown in the tags from android.googlesourcecode.
For example, I want to download calendar code
https://android.googlesource.com/platform/packages/apps/Calendar
I also want to download the code of android specific version tag. For example,android-4.0.3_r1.1 from the following link
https://android.googlesource.com/platform/packages/apps/Calendar/+/android-4.0.3_r1.1.
When I browse this code from git repositories it doesn't show the tag's version of code. How do I do this?
All the tags are listed in the Calendar page under All Tags. That page contains android-4.0.3_r1.1.
If you clone the repo and look for that tag, you will find it as well. For example:
C:\prog\git>git clone https://android.googlesource.com/platform/packages/apps/Calendar
Cloning into 'Calendar'...
remote: Counting objects: 80, done
remote: Finding sources: 100% (80/80)
remote: Total 30504 (delta 15730), reused 30504 (delta 15730)
Receiving objects: 100% (30504/30504), 11.16 MiB | 4.61 MiB/s, done.
Resolving deltas: 100% (15730/15730), done.
C:\prog\git>cd Calendar
C:\prog\git\Calendar>git tag|grep 4.0.3
android-4.0.3_r1
android-4.0.3_r1.1
...
From there, a simple git checkout android-4.0.3_r1.1 will allow you to browse the sources for that specific tag.

Resources