Git

How to setup GIT private server

  1. Log into server, create git account, set it to use git-shell (no login), add .ssh/authorized keys for access with no password.
  2. Create repo with $ git init --bare repository

1. On client edit

  1. On client pc clone with $ git clone githost:repository

  2. #(edit some files
  3. git commit -a # Commit all changes to the local version of the repository

  4. git push origin master # Push changes to the server's version of the repository

Nice Git prompt in Linux bash

Git submodule

Submodule, with github.com https token

  1. In github.com, under usersettings -> developer -> generate token to be uses in place of pwd.

    • then with token=<thetoken>

      git submodule add https://my2022token:<thetoken>@https://github.com/<user>/<gitrepo>.git

Cleanup local branches already merged into Master

  1. Check what has not been merged with  git branch --no-merged 

  2. Delete branch  git branch -d  xxx 

  3. . All in one  git branch --merged master | grep -v "\* master" | xargs -n 1 git branch -d 

Manage homedir on new server from existing git repo

Working with github and upstream git repos

Create branch based on upstream but pushed to my forked origin

$ git remote
origin
upstream
$ git fetch --all --tag
Fetching origin
Fetching upstream
$ checkout -b fix#733-myBranch
$ git reset --hard upstream/master
$ git push --set-upstream origin fix#733-myBranch

...


CategoryLinux

GitHowTo (last edited 2022-02-14 03:19:33 by PieterSmit)