Recent Changes - Search:

edit SideBar

Git

Below are various issues about Git.

Git Resources

Converting from SVN to Git

Sadly, I'm drinking the Koolaid and converting various repos from svn to git. Do I think this is a good idea? No. The main reason to the conversion is that no other version control system has stepped up, so git is the successor to svn. My hope is that some day, someone will convert the repos from git to version-control-d'jour.

Notes are below.

git svn clone fails with "error: git-svn died of signal 11"

This is fixed in libsvn-perl 1.9.4, so I updated to Ubuntu 17.x

git svn show-ignore fails with "command returned error: 1"

cxh@wessel:~/src/git/tmp$ git svn show-ignore > .gitignore
config --get svn-remote.svn.fetch :refs/remotes/git-svn$: command returned error: 1

See git svn show-ignore gives error "command returned error: 1" (stackoverflow)

Here, the solution was to run

  git svn show-ignore --id=origin/trunk > .gitignore

"error: refname refs/heads/trunk not found"

cxh@wessel:~/new-bare.git$ git branch -m trunk master
error: refname refs/heads/trunk not found
fatal: Branch rename failed

My workaround:

  git branch -m origin/trunk master

Then

cxh@wessel:~/src/git/ptII/tmp$ git push bare
Counting objects: 822255, done.
Delta compression using up to 24 threads.
Compressing objects: 100% (177492/177492), done.
Writing objects: 100% (822255/822255), 912.79 MiB | 54.60 MiB/s, done.
Total 822255 (delta 663295), reused 799278 (delta 640318)
remote: Resolving deltas: 100% (663295/663295), done.        
remote: Checking connectivity: 822255, done.        
To /home/cxh/new-bare.git
 * [new branch]            origin/8_0_devel_prewidth -> origin/8_0_devel_prewidth
 * [new branch]            origin/handsimdroid -> origin/handsimdroid
 * [new branch]            origin/hlacerti-2016 -> origin/hlacerti-2016
 * [new branch]            origin/hlacerti2017 -> origin/hlacerti2017
 * [new branch]            origin/initialization-rework -> origin/initialization-rework
 * [new branch]            origin/jmathlib -> origin/jmathlib
 * [new branch]            origin/js-this -> origin/js-this
 * [new branch]            origin/kepler-2-3 -> origin/kepler-2-3
 * [new branch]            origin/kepler-2-4 -> origin/kepler-2-4
 * [new branch]            origin/kepler-2-5 -> origin/kepler-2-5
 * [new branch]            origin/osgi-1-0 -> origin/osgi-1-0
 * [new branch]            origin/osgi-2-0 -> origin/osgi-2-0
 * [new branch]            origin/osgi-2-0-cq-1 -> origin/osgi-2-0-cq-1
 * [new branch]            origin/rel-0-3 -> origin/rel-0-3
 * [new branch]            origin/rel-0-3-alpha -> origin/rel-0-3-alpha
 * [new branch]            origin/rel-0-3-alpha-1 -> origin/rel-0-3-alpha-1
 * [new branch]            origin/rel-0-4 -> origin/rel-0-4
 * [new branch]            origin/rel-0-4-beta -> origin/rel-0-4-beta
 * [new branch]            origin/rel-0-4-beta-2 -> origin/rel-0-4-beta-2
 * [new branch]            origin/rel-1-0-beta -> origin/rel-1-0-beta
 * [new branch]            origin/rel-10-0-beta -> origin/rel-10-0-beta
 * [new branch]            origin/rel-2-0-beta -> origin/rel-2-0-beta
 * [new branch]            origin/rel-2-2-beta -> origin/rel-2-2-beta
 * [new branch]            origin/rel-3-0-beta -> origin/rel-3-0-beta
 * [new branch]            origin/rel-4-0-beta -> origin/rel-4-0-beta
 * [new branch]            origin/rel-5-0-beta -> origin/rel-5-0-beta
 * [new branch]            origin/rel-6-0-alpha -> origin/rel-6-0-alpha
 * [new branch]            origin/rel-6-0-beta -> origin/rel-6-0-beta
 * [new branch]            origin/rel-7-0-beta -> origin/rel-7-0-beta
 * [new branch]            origin/rel-7-0-beta-2 -> origin/rel-7-0-beta-2
 * [new branch]            origin/rel-8-0-beta -> origin/rel-8-0-beta
 * [new branch]            origin/rel-8-0-beta-2 -> origin/rel-8-0-beta-2
 * [new branch]            origin/ressurect -> origin/ressurect
 * [new branch]            origin/tags/Final -> origin/tags/Final
 * [new branch]            origin/tags/KEPLER_1_0_0_MARKER -> origin/tags/KEPLER_1_0_0_MARKER
 * [new branch]            origin/tags/triq_initial_contrib -> origin/tags/triq_initial_contrib
 * [new branch]            origin/test -> origin/test
 * [new branch]            origin/trunk -> origin/trunk
 * [new branch]            origin/test -> origin/test
 * [new branch]            origin/trunk -> origin/trunk
 * [new branch]            origin/vertx-3-0-0 -> origin/vertx-3-0-0
 * [new branch]            origin/vertx-3-4-1 -> origin/vertx-3-4-1
 * [new branch]            origin/walker -> origin/walker
cxh@wessel:~/src/git/ptII/tmp$

Summary of what worked to convert from git to svn

As per 9.2 Git and Other Systems - Migrating to Git create authors-transform.txt

svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-transform.txt

Then update authors-transform.txt

Run git svn in an empty directory and tar up the results so that it is easy to retry the git commands.

mkdir tmp
cd tmp
nohup git svn clone https://repo.eecs.berkeley.edu/svn/projects/eal/ptII --no-metadata -A ../authors-transform.txt --stdlayout ~/src/git/ptII.2/tmp >& g2.out &
cd ..
tar -zcf tmp.tar.gz tmp

If necessary, create a clean copy of the output of git svn, then run the commands from 9.2 Git and Other Systems - Migrating to Git

rm -rf tmp
tar -zxf tmp.tar.gz
cd tmp
for t in $(git for-each-ref --format='%(refname:short)' refs/remotes/tags); do git tag ${t/tags\//} $t && git branch -D -r $t; done
for b in $(git for-each-ref --format='%(refname:short)' refs/remotes); do git branch $b refs/remotes/$b && git branch -D -r $b; done
for p in $(git for-each-ref --format='%(refname:short)' | grep @); do git branch -D $p; done
rm -rf ~/new-bare.git;git init --bare ~/new-bare.git;git remote add origin ~/new-bare.git
git push -u origin --all
git push -u origin --tags
cd ~/new-bare.git/
git remote add origin https://github.com/icyphy/ptII.git
git push -u origin '*:*'

Git under Windows

http://kylecordes.com/2010/git-gui-client-windows - 2010 overview of git clients

Installation of Git and cloning a repository

  1. Go to http://git-scm.com/downloads and download and install the Windows client. In July, 2012, I downloaded https://github.com/downloads/msysgit/git/Git-1.7.11-preview20120620.exe For a tutorial, see http://nathanj.github.com/gitguide/tour.html
  2. Start up the Git GUI with: Start -> All Programs -> Git -> Git GUI
  3. In the Git GUI window, click on Help -> Show SSH Key -> Generate Key
  4. Click on Copy to Clipboard
  5. Go to the Redmine site and paste the contents in the ssh key window
  6. In Windows, go back to Git GUI and click on clone existing repository
    1. For source location, enter git-tess@tessellation.cs.berkeley.edu:fcrp-whitepaper.git
    2. For target directory, choose any directory
    3. Click on Clone

Committing a change

  1. Use an editor to make a trivial change to a file. A possible LaTeX tool to try is TexWorks
  2. In the Git GUI window, note that the change will show up in "Unstaged Changes". If it does not try Commit -> Rescan
  3. To commit your changes to your local repository, click on the file in Unstaged Changes and then Commit -> Stage to Commit
  4. Enter a message in the Commit Message window and press Commit.
  5. To push your changes to the master, press the Push button.

Pulling changes from the server

In Git GUI, I think you need to do a fetch and then a merge, see http://git.661346.n2.nabble.com/No-quot-pull-quot-in-git-gui-td1121058.html

In Git GUI, I did:

  1. Remote -> Fetch From -> origin
  2. Merge -> Local Merge.

There is probably a way to do this using Git GUI, see http://nathanj.github.com/gitguide/tour.html

However, I find it easier to start up Git Bash and run commands by hand:

$ git branch --set-upstream master origin/master
Branch master set up to track remote branch master from origin.

Administrator@JOULE ~/src/fcrp4 (master)
$ git pull
Already up-to-date.

Criticisms of Git

Git is all the rage because it is "better than Subversion". Git was created to be fix shortcomings in Subversion (SVN), in a similar manner to how SVN was created to fix shortcomings in CVS. Yet, like SVN has problems not present in CVS, Git has problems not present in SVN.

This is a common pattern, see ant vs. make.

When will we stop reinventing the wheel and having the new version have more problems than the old version.

Most users could care less about what version control system they use. They want to use the same commands to get the same results without worrying about whether the version control system is SCCS, RCS, CVS, SVN, Git or Git's as yet unborn replacement. Fortunately, tools like Eclipse and Emacs insulate the user from poorly designed and/or implemented version control tools, but do we really need to keep banging our heads against the wall.

Distributed version control is a good thing, why mess it up with trivial differences between the predecessors?

Trivial incompatibilities between Git and SVN

Sadly, Git has trivial differences from SVN.

Trivial differences in similar tools cause people to waste time.

If git is better than svn, then why does git have problems that svn does not have?

The pager

Why does git insist on using a pager? Other Unix tools don't do this. I run my shells inside emacs so I don't need a pager. Under git 1.7.10 under RHEL 5.8, inside Emacs, I get:

bash-3.2$ git diff
WARNING: terminal is not fully functional
diff --git a/src/shared/sim_support.h b/src/shared/sim_support.h^[[m
index 36c7459..cbcb620 100644^[[m
--- a/src/shared/sim_support.h^[[m
+++ b/src/shared/sim_support.h^[[m
@@ -41,6 +41,7 @@^[[m
#define DLL_DIR2 "binaries/linux64/"^[[m
#endif /*__x86_64*/^[[m
#define DLL_SUFFIX ".so"^[[m
+#define DLL_SUFFIX2 ".so"^[[m
#endif /*__APPLE__*/^[[m
#endif /*WINDOWS*/^[[m
^[[m

Yes, I know I can Prevent git from using a pager with

git config --global core.pager cat

  1. Why do I have to do this on every machine that I use for every account?
  2. If git is going to use a pager, then it should sense that the terminal is not fully functional and then not use a pager
  3. If git is going to use a pager and the pager is not working, then it should tell the user how to turn off the pager.

Is this really all that hard?

git commit does not work with absolute paths

Under git 1.7.9.4 under Mac OS X 10.3, why can't I use an absolute path like I can with svn?

If this works:

bash-3.2$ svn commit -m "Testing commit using a relative path" ~/src/cpswww/index.html
Sending cpswww/index.html
Transmitting file data .
Committed revision 25.

Then shouldn't this work, too?

bash-3.2$ git commit -m "Define DLL_SUFFIX2 under Linux" ~/src/fmusdk/src/shared/sim_support.h
fatal: Not a git repository (or any of the parent directories): .git

Why doesn't "git co" work?

svn co is short for svn checkout. Should this just work in git? Why should the user learn yet another syntax for the same result?

-bash-3.2$ git --version
git version 1.7.8.2
-bash-3.2$ git co repoman@bambi.millennium.berkeley.edu:projects/embedded/gitTest.git
git: 'co' is not a git command. See 'git --help'.

Did you mean one of these?
commit
clone
log

Why do I need to use -a with git commit -m "message"

Under Subversion, when I run svn commit -m "message", then all the changes in the current directory and the directories below are committed.

Sadly, git requires me to use the -a argument?

bash-3.2$ git commit -m "Define DLL_SUFFIX2 under linux"
# On branch linux
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: ../Makefile
# modified: sim_support.h
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# ../../bin/fmusim_cs
# ../../bin/fmusim_me
# ../../fmuTmp4nS5pi/
# ../../fmuTmpJgFCee/
# ../../fmuTmpZn4QnA/
# ../../fmuTmpf6A8vJ/
# ../fmusim_cs
# ../fmusim_cs.dSYM/
# ../fmusim_me
# ../fmusim_me.dSYM/
no changes added to commit (use "git add" and/or "git commit -a")
bash-3.2$

Why be different than cvs and svn here?

Mac OS X Git Problems

git clone returns "error: Protocol https not supported or disabled in libcurl while accessing"

Under Mac OS X 10.7.4, git 1.7.7.3 was failing:

bash-3.2$ git clone https://bambi.millennium.berkeley.edu/git/projects/embedded/gitTest.git
Cloning into 'gitTest'...
error: Protocol https not supported or disabled in libcurl while accessing https://bambi.millennium.berkeley.edu/git/projects/embedded/gitTest.git/info/refs
fatal: HTTP request failed
bash-3.2$

Kostadin pointed out that the problem was with curl:

bash-3.2$ curl -k https://www.google.com
curl: (1) Protocol https not supported or disabled in libcurl

For a potential solution, see: http://naleid.com/blog/2009/03/16/enabling-https-support-in-curl-installed-through-macports-on-osx/

3/19/2013: Upgrading port seems to help with the above:

sudo port selfupdate
sudo port upgrade outdated

However, this error occurred:

bash-3.2$ git clone https://github.com/twall/jna.git
Cloning into 'jna'...
dyld: Library not loaded: /opt/local/lib/libcurl.4.dylib
Referenced from:
Reason: Incompatible library version: git-remote-https requires version 8.0.0 or later, but libcurl.4.dylib\
provides version 7.0.0
bash-3.2$

This helped:

export DYLD_LIBRARY_PATH=/opt/local/lib:${DYLD_LIBRARY_PATH}

Under Linux, I had to do

export LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH}

because /usr/bin/curl was getting the libcurl from matlab

Curl Under Jenkins

See Jenkins#CurlUnderJenkins

Linux Git Problems

RHEL: error setting certificate verify locations

bash-4.1$ git clone https://github.com/terraswarm/jsdoc.git/
Cloning into 'jsdoc'...
fatal: unable to access 'https://github.com/terraswarm/jsdoc.git/': error setting certificate verify locations:
  CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: none
bash-4.1$

The solution was as root to do:

   ln -s /etc/pki/tls/certs/ca-bundle.crt /etc/ssl/certs/ca-certificates.crt

See https://stackoverflow.com/questions/3160909/how-do-i-deal-with-certificates-using-curl-while-trying-to-access-an-https-url for useful information, but not the precise answer.

Gtk-WARNING **: cannot open display

Under RHEL 5.8, I can't run git unless I have an X11 connection?


The problem is that running I run ssh via emacs, I tend not to run ssh -X and when I do run ssh -X, the connection tends to get dropped after awhile.

(:source language="bash")
bash-3.2$ git clone https://bambi.millennium.berkeley.edu/git/projects/embedded/gitTest.git |
Cloning into 'gitTest'... |
The application 'gnome-ssh-askpass' lost its connection to the display localhost:11.0; |
most likely the X server was shut down or you killed/destroyed |
the application. |
bash-3.2$

One solution is to invoke unset SSH_ASKPASS:

-bash-3.2$ git clone https://bambi.millennium.berkeley.edu/git/projects/embedded/gitTest.git
Cloning into 'gitTest'...
Username for 'bambi.millennium.berkeley.edu': cxh

Password for 'bambi.millennium.berkeley.edu':
warning: You appear to have cloned an empty repository.
-bash-3.2$

git clone returns "error: The requested URL returned error: 401 while accessing"

[cxh@joulecentos ~]$ cat /etc/redhat-release
Red Hat Enterprise Linux Workstation release 6.2 (Santiago)
[cxh@joulecentos ~]$ git --version
git version 1.7.1
[cxh@joulecentos ~]$ git clone https://bambi.millennium.berkeley.edu/git/projects/embedded/gitTest.git
Initialized empty Git repository in /home/cxh/gitTest/.git/
error: The requested URL returned error: 401 while accessing https://bambi.millennium.berkeley.edu/git/projects/embedded/gitTest.git/info/refs

fatal: HTTP request failed
[cxh@joulecentos ~]$

Try adding the username to the url:

[cxh@joulecentos ~]$ git clone https://cxh@bambi.millennium.berkeley.edu/git/projects/embedded/gitTest.git
Initialized empty Git repository in /home/cxh/gitTest/.git/
Password:
warning: You appear to have cloned an empty repository.
[cxh@joulecentos ~]$

Mac OS X: Git fails with git-remote-https requires version 8.0.0 or later, but libcurl.4.dylib provides version 7.0.0

bash-3.2$ git clone https://github.com/alexruiz/fest-assert-2.x.git
git clone https://github.com/alexruiz/fest-assert-2.x.git
Cloning into 'fest-assert-2.x'...
dyld: Library not loaded: /opt/local/lib/libcurl.4.dylib
Referenced from:
Reason: Incompatible library version: git-remote-https requires version 8.0.0 or later, but libcurl.4.dylib provides version 7.0.0
bash-3.2$ ldd /opt/local/libexec/git-core/git-remote-https
/opt/local/libexec/git-core/git-remote-https:
/opt/local/lib/libpcre.1.dylib (compatibility version 4.0.0, current version 4.0.0)
/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.7)
/opt/local/lib/libiconv.2.dylib (compatibility version 8.0.0, current version 8.1.0)
/opt/local/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.2.0)
/opt/local/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/opt/local/lib/libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/opt/local/lib/libcurl.4.dylib (compatibility version 8.0.0, current version 8.0.0)
/opt/local/lib/libexpat.1.dylib (compatibility version 8.0.0, current version 8.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)

Solution:

export DYLD_LIBRARY_PATH=/opt/local/lib:${DYLD_LIBRARY_PATH}
Edit - History - Print - Recent Changes - Search
Page last modified on March 06, 2018, at 11:38 pm