mkdir ~/.git-templates
git config --global init.templatedir ~/.git-templates
git config -l
mkdir -p ~/.git-templates
tar -xvzf git-templates.tgz -C ~/.git-templates
get the url
cd ~/some-git-repo
git ls-remote --get-url 'origin'
EDIT ~/.gitconfig
and add an entry
[user "url-from--get-url"]
email = sample@eml
name = name surname
check it is working
git clone <url-from--get-url>
references: git-templates.tgz
cd ~/src/repo
git init --bare package.git
cd /tmp
git clone /path/package.git
cd package
mkdir -p src
touch src/file_with_classes.php
touch composer.json
composer.json
{
"name": "vendor/package",
"autoload": {
"classmap": ["src/"]
}
}
I’m using classmap
because I want more classes in the same php file, but there are more options, if using classmap
remember to refresh the autoloader when classes are added/removed (composer -o dumpautoload
)
and commit-push
git commit src/file_with_classes.php composer.json
git push
cd project/backend
composer init
composer.json
"repositories": [
{
"type": "vcs",
"url": "/home/user/src/repo/package.git"
}
],
or, if using lan repositories shared with something like
git daemon --base-path=. --export-all --verbose --enable=receive-pack
edit composer.json
"repositories": [
{
"type": "vcs",
"url": "git://192.168.1.1/package.git"
}
],
"config": {
"secure-http": false
},
composer require "vendor/package" "dev-master"
create a repository
cd /var/git
mkdir my-new-repo.git
cd my-new-repo.git
git --bare init
/etc/apache2/conf-available/git-http.conf:
SetEnv GIT_PROJECT_ROOT /var/git
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ /usr/lib/git-core/git-http-backend
#/usr/libexec/git-core/git-http-backend/
RewriteCond %{QUERY_STRING} service=git-receive-pack [OR]
RewriteCond %{REQUEST_URI} /git-receive-pack$
RewriteRule ^/git/ - [E=AUTHREQUIRED:yes]
<LocationMatch "^/git/">
Order Deny,Allow
Deny from env=AUTHREQUIRED
AuthType Basic
AuthName "Git Access"
# Require group committers
# Satisfy Any
AuthUserFile /etc/apache2/passwd.git
Require valid-user
</LocationMatch>
enable the conf, create the user/password
a2enconf git-http
htpasswd -c /etc/apache2/passwd.git <user>
# restart apache
Having an alien FILE-edited.c
find which version in git repository is the most similar
git log --pretty=format:%h FILE.c | \
while read -r HASH ; do \
git checkout $HASH; \
WCL=$(diff FILE.c FILE-edited.c|wc -l); \
echo "$WCL $HASH"; done |sort |head
rsync -av "PROJECT.cvs.sourceforge.net::cvsroot/PROJECT/*" /tmp/old-cvs
cd /tmp/new-git
git cvsimport -A /tmp/names -o master -d /tmp/old-cvs module
where /tmp/names have the format:
unixname=Real Name <mail>