moji

moji

git - clone - the remote end hung up unexpectedly - # solution - change

compression:

˜ git config --global --add core.compression -1

or:

˜ git config --global core.compression 0

then:

˜ git config --global -e

add the following to the file:

˜ [core] ˜ packedGitLimit = 512m ˜ packedGitWindowSize = 512m ˜ [pack] ˜ deltaCacheSize = 2047m ˜ packSizeLimit = 2047m ˜ windowMemory = 2047m

also:

˜ export GIT_TRACE_PACKET=1 ˜ export GIT_TRACE=1 ˜ export GIT_CURL_VERBOSE=1 ˜ git fetch --unshallow ˜ git pull --all

v1:

˜ git rev-list --objects --all \ ˜ | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) ˜ %(rest)' \ ˜ | sed -n 's/^blob //p' \ ˜ | sort --numeric-sort --key=2 \ ˜ | tail -n 10 \ ˜ | cut -c 1-12,41- \ ˜ | $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B ˜ --padding=7 --round=nearest

v2:

from here

˜ git ls-tree -r --long HEAD | sort -k 4 -n -r | less

What you are trying to do is called a sparse checkout, and that feature was

added in Git 1.7.0 (Feb. 2012). The steps to do a sparse clone are as follows:

˜ mkdir ˜ cd ˜ git init ˜ git remote add -f origin

This creates an empty repository with your remote, and fetches all objects but

doesn't check them out. Then do:

˜ git config core.sparseCheckout true

Now you need to define which files/folders you want to actually check out.

This is done by listing them in .git/info/sparse-checkout, eg:

˜ echo "some/dir/" >> .git/info/sparse-checkout ˜ echo "another/sub/tree" >> .git/info/sparse-checkout

Last but not least, update your empty repo with the state from the remote:

˜ git pull origin master

You will now have files "checked out" for some/dir and another/sub/tree on your

file system (with those paths still), and no other paths present.

You might want to have a look at the extended tutorial and you should probably read the official documentation for sparse checkout and read-tree.

Downloading after changing the .git/info/sparse-checout file:

˜ ˜ git read-tree -mu HEAD ˜ git pull origin main

git repository setup

Install GIT from : https://git-scm.com/

configure (only needed once):

˜ git config --global user.name "Name"` ˜ git config --global user.email "EMail"

access gitlab

SSH key from within git bash

Check if you already have a key:

˜ cat ~/.ssh/id_rsa.pub

if not you can generate one:

˜ ssh-keygen -t rsa -C "your.email@example.com" -b 4096

Get the key o your clipboard :

Windows:

˜ type %userprofile%\.ssh\id_rsa.pub | clip

Mac:

˜ pbcopy < ~/.ssh/id_rsa.pub

Copy the Key in your user account on GitLab. Test if the key works:

˜ ssh -T git@gitlab.fhnw.ch:.../abc.git

Get the correct git address from the repository.

From now on you can simply connect to the repository from you "trusted" pc.

Test the Key

cloning Repository onto your disk

Open GITGUI in the location where you would like to clone the repository into and select clone.

Source:

˜ git@gitlab.fhnw.ch:.../abc.git

Location:

˜ .\DIRNAME

Note that there should not already ne a directory named DINAME in the folder!

Alternatively with GITBASH type:

˜ git clone git@gitlab.fhnw.ch:.../abc.git

This will create a directory named "abc".

configure and use merge tool

Install Meld from: http://meldmerge.org/

then in GITBASH:

Windows

˜ git config --global diff.tool meld ˜ git config --global difftool.meld.path "C:\Program Files (x86)\Meld\Meld.exe" ˜ git config --global difftool.prompt false ˜ git config --global merge.tool meld ˜ git config --global mergetool.meld.path "C:\Program Files (x86)\Meld\Meld.exe" ˜ git config --global mergetool.prompt false

Linux and maybe Mac

˜ git config --global diff.tool meld ˜ git config --global difftool.meld.path "/usr/bin/meld" ˜ git config --global difftool.prompt false ˜ git config --global merge.tool meld ˜ git config --global mergetool.meld.path "/usr/bin/meld" ˜ git config --global mergetool.prompt false

workflow

guibash

At the beginning get the new version:

˜ git pull origin master

Afetr editing put all back:

˜ git add -A ˜ git commit -m "MESSAGE" ˜ git push origin master

if `pull` gives you a conflict:

˜ git commit -m "MESSAGE" ˜ git mergetool ˜ git commit -m "MESSAGE" ˜ git push origin maste

references and links

Associating text editors with Git - User Documentation

Corey Schafer - Git Tutorial: Diff and Merge Tools

LevelUpTuts - GitLab Tutorials

cloning a fresh and empty repository

if you create a freh repository and clone the emty one for the first time:

˜ git clone git@site:user/rep.git ˜ cd rep ˜ git checkout -b main // this sets the name of the default branch to main ˜ git add -A ˜ git commit -m "some description" ˜ git push origin main

undo unstaged and umcommited cnages vback to last commit

˜ git status

this will tell you the changes and suggest how to undo them, This may be

˜ git restore filename

or

˜ git checkout --filename

follow the suggestions.