WSL+Docker環境でのGit
WSL+Docker環境で開発する際にソースコードをGit管理したい。
ソースはWSL側にマウントして使うことを想定。
1. WSL内にGitをインストール
2. Git初期化・コミット
ソースはWSL側にマウントして使うことを想定。
1. WSL内にGitをインストール
通常、WSL(Ubuntuなど)には最初からGitが入っているが、念のため最新の状態に更新しておく。
WSL(Ubuntu)のターミナルで以下コマンドを実行。
実行結果:
Gitを使うための初期設定を行っておく。
→ 「Git:インストール後に最低限やっておくこと」
WSL(Ubuntu)のターミナルで以下コマンドを実行。
sudo apt update
sudo apt install git -y
sudo apt install git -y
実行結果:
xxx@xxx:~/docker/node.js$ sudo apt update
[sudo] password for xxx:
Hit:1 https://download.docker.com/linux/ubuntu noble InRelease
Hit:2 http://archive.ubuntu.com/ubuntu noble InRelease
Get:3 http://archive.ubuntu.com/ubuntu noble-updates InRelease [126 kB]
Get:4 http://security.ubuntu.com/ubuntu noble-security InRelease [126 kB]
Get:5 http://archive.ubuntu.com/ubuntu noble-backports InRelease [126 kB]
Get:6 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages [1969 kB]
Get:7 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Components [177 kB]
Get:8 http://archive.ubuntu.com/ubuntu noble-updates/universe amd64 Packages [1688 kB]
Get:9 http://archive.ubuntu.com/ubuntu noble-updates/universe amd64 Components [387 kB]
Get:10 http://archive.ubuntu.com/ubuntu noble-updates/multiverse amd64 Components [940 B]
Get:11 http://archive.ubuntu.com/ubuntu noble-backports/main amd64 Components [5744 B]
Get:12 http://archive.ubuntu.com/ubuntu noble-backports/universe amd64 Components [10.5 kB]
Get:13 http://security.ubuntu.com/ubuntu noble-security/main amd64 Components [21.9 kB]
Get:14 http://security.ubuntu.com/ubuntu noble-security/universe amd64 Components [74.1 kB]
Fetched 4713 kB in 1s (3278 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
45 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: https://download.docker.com/linux/ubuntu/dists/noble/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
xxx@xxx:~/docker/node.js$ sudo apt install git -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
git is already the newest version (1:2.43.0-1ubuntu7.3).
git set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 45 not upgraded.
Gitを使うための初期設定を行っておく。
→ 「Git:インストール後に最低限やっておくこと」
2. Git初期化・コミット
あとは通常通りに git init → git add → git commit で変更をコミットすれば良い。
0 件のコメント:
コメントを投稿