以åã®Git LFSã¯å¸¸ã«HTTPã§ãµã¼ãã«æ¥ç¶ãã¦ãã¾ããã
ããããgit-lfsã®æè¿ã®ãã¼ã¸ã§ã³ã¯SSHæ¥ç¶ããµãã¼ããã¦ãã¾ãã
ã¾ãããªã¢ã¼ãã®Gitã¬ãã¸ããªã¨ã¯éãå ´æã«SSHã§æ¥ç¶ããGit LFSã®ãµã¼ããä½ããã¨ãã§ãã¾ãã
ãããããã¨
- ãªã¢ã¼ãã®Gitã¬ãã¸ããªã¨ã¯å¥ã®SSHã§ã¢ã¯ã»ã¹ã§ãããã·ã³ãGit LFSã®ãµã¼ãã«ãã¦ãã¼ã¿ãç½®ãããã
æ¡ä»¶ç
- LinuxãªSSHãµã¼ããæ¢ã«ãããã¨ã«ããSSHæ¥ç¶ã ãã§æ¸ã¾ãããã
- éã«è¨ãã¨ãSSHæ¥ç¶ãåæãªã®ã§ããããªãã¯ãªã¬ãã¸ããªã§ã¯ã»ãã¥ãªãã£çã«å¤§å¤ããããã¾ããã
- Git LFSã®ããã¯æ©è½ã«ã¯èå³ãç¡ã
- ä»åãGit LFSã®ããã¯æ©è½ã¯å ¨ãæ¤è¨¼ãã¦ãã¾ããã
Git LFSãµã¼ãå´ã®è¨å®
æ¢ã«SSHã®ãµã¼ãã¯è¨å®ããã¦ãããã®ã¨ãã¾ãã
Git LFSãSSHçµç±ã§ä½¿ãå ´åããµã¼ãå´ã«git-lfs-transferã¨ããå®è¡ãã¡ã¤ã«ãå¿ è¦ã§ãã ä»åã¯ãGit LFSã¯ã©ã¤ã¢ã³ãå´ã®éçºæã«ãªãã¡ã¬ã³ã¹å®è£ ã¨ãã¦ç¨ããããscutiger-lfsã使ãã¾ãã Rustã§å®è£ ããã¦ãã¾ãã
ã¡ãªã¿ã«ã2023å¹´12æç¾å¨ãGit LFSã®å®è£ ãªã¹ãã«ããã¨ãgit-lfs-transferã®å®è£ ã¯ä»ã«2ã¤ããã¾ãã
git-lfs-transfer ã®ãã«ãã¨ã¤ã³ã¹ãã¼ã«
以ä¸ã¯Debian 12 (bookworm)ãæ³å®ããæé ã¨ãªãã¾ãã ãããå°æ¥git-lfs-transferå®è£ ã®ã©ãããDebianããã±ã¼ã¸åãããã°ããããã¤ã³ã¹ãã¼ã«ããã ãã§è¯ãã¯ãã§ãã
ã¾ããScutigerã®READMEã«ããã¨ããã«ãã«ã¯Rust 1.63以éãCargoãGnu Makeãgitãå¿ è¦ã§ãã å ãã¦ãzlibãlibpcre2ãlibgit2ã®ãã¤ãããã¯ãªã³ã¯ãæ¨å¥¨ããã¦ããã®ã§ããããã®éçºç¨ããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«ãã¾ãã
sudo apt update sudo apt install rustc cargo make git zlib1g-dev libpcre2-dev libgit2-dev
次ã«ãScutigerã®ã½ã¼ã¹ããã¦ã³ãã¼ããã¦ãã«ããã¾ãã
ããã¦ãã«ããããgit-lfs-transfer
ã/usr/local/bin
ã«ã¤ã³ã¹ãã¼ã«ãã¾ãã
(ããã§ã¯/usr/local/bin
ã«ãã¹ãéã£ã¦ãããã®ã¨ãã¾ãã)
git clone https://github.com/bk2204/scutiger cd scutiger make sudo cp target/release/git-lfs-transfer /usr/local/bin/
Git LFSç¨ã®ãã£ã¬ã¯ããªãä½æ
Git LFSã®ãã¼ã¿æ ¼ç´ç¨ã®ãã£ã¬ã¯ããªã¨ãã¦ã空ã®Gitã¬ãã¸ããªãä½æãã¦ãã ããã
ããã§ã¯ãã®ãã¹ã/home/gituser/git/testrepo.git
ã¨ãã¾ãã
git init --bare --shared /home/gituser/git/testrepo.git
ãã®ããã«bareã¬ãã¸ããªãä½æããå ´åãå®éã®Git LFSã®ãã¼ã¿ã¯/home/gituser/git/testrepo.git/lfs/
ã«æ ¼ç´ããã¾ãã
(注: SSHè¶ãã«Gitãç¨ããå ´åã¯Gitã¬ãã¸ããªãgroup writableã«ãããã¨ãå¤ããããä¾ã§ã--shared
ãæå®ãã¦ãã¾ãã)
ãããã¯ãbareã¬ãã¸ããªã«ããªãã¦ããã¾ãã¾ããã
Git LFSã®ãã¼ã¿ãæ ¼ç´ããbareã§ã¯ãªãGitã¬ãã¸ããªã/home/gituser/git/testrepo
ã®æãGit LFSã®ãã¼ã¿ã¯ /home/gituser/git/testrepo/.git/lfs/
ã«æ ¼ç´ããã¾ãã
scutiger-lfsã®git-lfs-transferã¯Gitã¬ãã¸ããªã®ä¸ã«ããGit LFSã®ãã£ã¬ã¯ããªãé ç½®ã§ããªããããªã®ã§ä»åã¯ç©ºã®Gitã¬ãã¸ããªãä½ã£ã¦ãã¾ããããã®è¾ºã¯git-lfs-transferã®å®è£ ã«ãã£ã¦ãç°ãªãã¨æãã¾ãã
ãµã¼ãå´ã®è¨å®ã¯ããã§çµããã§ãã
ã¯ã©ã¤ã¢ã³ãå´ã®è¨å®
ãã¼ã«ã«ã®Gitã¬ãã¸ããªã®è¨å® (Gitã¬ãã¸ããªã¨ã¯å¥ã®å ´æã«Git LFSãµã¼ããç½®ãããå ´å)
ããã§ã¯ãGit LFSãµã¼ãã®ãã¹ãåãssh.example.com
ã§ããã¨ãã¾ãã
Git LFSã®ã¨ã³ããã¤ã³ããssh.example.com
ã«åããããã«ããã¼ã«ã«ã®Gitã¬ãã¸ããªã®ããããã£ã¬ã¯ããªã§
git config -f .lfsconfig lfs.url ssh://ssh.example.com/home/gituser/git/testrepo.git
ãå®è¡ãã¾ããã¾ãããããã¼ãçªå·ã(22ã§ã¯ãªã)12345ã§ããã°
git config -f .lfsconfig lfs.url ssh://ssh.example.com:12345/home/gituser/git/testrepo.git
ã¨ãªãã¾ãã
ãã®ä»ã¯é常ã®Git LFSã¨åã使ãæ¹ã«ãªãã¾ããã¾ãã¯
git lfs install
ãå®è¡ãã¦ãã ããã ãã ãã以ä¸ã®è£è¶³ã«ã¦è¿°ã¹ãããã«ã追å ã§
git config lfs.ssh.automultiplex false
ãå®è¡ããå¿ è¦ãããããããã¾ããã
è£è¶³
ãã¼ã«ã«å´ãæ£ããè¨å®ããã¦ããã°ã
git lfs env
ã®å®è¡çµæã«Endpoint=https://ssh.example.com/home/gituser/git/testrepo.git (auth=none) [email protected]:/home/gituser/git/testrepo.git
ã¨ããè¡ãããã¯ãã§ãã ãªããSSHã®ãã¼ãçªå·ãæå®ããå ´åããã®å¤ãããã§ã¯è¡¨ç¤ºãããªããã®ã®ãå é¨ã§å¼ã°ããå®éã®sshã³ãã³ãã§ã¯-pãªãã·ã§ã³ã§ãã¼ãçªå·ãæå®ããã¾ãã
ç¹°ãè¿ãã«ãªãã¾ãããä»åç¨ããgit-lfs-transferå®è£ ã®é½åã«ãã
/home/gituser/git/testrepo.git
ã¨ãã空ã®Gitã¬ãã¸ããªãä½æãã¦ããã ãã§ããããGitã¬ãã¸ããªã¨ãã¦ã¯ä½¿ããªãæ³å®ã§ãã
ã¨ã¯ããããã¡ããGitã¬ãã¸ããªã¨ãã¦æ®éã«ä½¿ããã¨ãã§ãã¾ãã ããã«ã.lfsconfig ããªããã°ãGit LFSã®ã¨ã³ããã¤ã³ãã¯ãªã¢ã¼ãã®Gitã¬ãã¸ããªã¨åãå ´æã«ãªãã¾ãã ã¤ã¾ãããªã¢ã¼ãã®Gitã¬ãã¸ããªã«SSHã§ã¢ã¯ã»ã¹ãããæ§æãªãããã®ãªã¢ã¼ãã®ãã·ã³ã«git-lfs-transferã追å ã§ã¤ã³ã¹ãã¼ã«ããã ãã§Git LFSã使ãã¾ãã
(ã¨ããããä»åã®ããã«ãªã¢ã¼ãã®Gitã¬ãã¸ããªã¨Git LFSãµã¼ããå¥ã®ãã¹ãã«ããæ¹ãç¹æ®ã ã¨æãã¾ãã)OpenSSHã使ã£ã¦ããå ´åãè¤æ°ã®SSHéä¿¡ã1ã¤ã®ã³ãã¯ã·ã§ã³ã«ã¾ã¨ãããã¨ãã§ãã¾ã(ãã«ããã¬ãã·ã³ã°)ã ããã©ã«ãã§ã¯ãã®æ©è½ãæå¹ã«ãªã£ã¦ãã¾ãããã¯ã©ã¤ã¢ã³ãã¨ãµã¼ããåããã¹ãã«ããå ´åã«git pushãéä¸ã§æ¢ã¾ã£ã¦ãã¾ã£ããã¨ãç°å¢ã«ãã£ã¦ã¯æ£ããåä½ããªããã¨ãããã¾ãã ãã®å ´åã¯
git config lfs.ssh.automultiplex false
ãå®è¡ãã¦ããã«ããã¬ãã·ã³ã°ãç¡å¹ã«ãã¦ãã ããã
(SSHæ¥ç¶ã«éã£ã話ã§ã¯ããã¾ããã)
.gitattributes
ã®ã³ãããã¯å¿ããããã®ã§æ°ãã¤ãã¾ãããã