ターミナル上で操作する方法
#GitHub
ここではターミナル上でGitHubを操作する方法を載せておきます
ブランチを使う方法は以下参照
共同開発等で使うBranchについて
コマンドでbranchを切る方法
ターミナル上の標準コマンド一覧
ls 階層内の情報を持ってくる
cd 階層移動
例)
cd unity unityというフォルダに移動する
cd .. で一つ前の階層に戻る
mkdir フォルダの作成
touchでファイルの作成
例)
touch text.txt
touch README.md
mdは説明とかに使える(GitHub)
Gitの初期設定
init→config→remote add originの部分
git init
Gitリポジトリを新しく作成するコマンド。
これを入力するとカレントディレクトリをGitリポジトリに変換する。
git config --global user.name "ユーザー名"
git config --global user.email "GitHubのメールアドレス"
git remote add origin リポジトリのリンク(https)
リポジトリのリンクはGItHubのyour repositoryから作成したものを使用
確認
ユーザー名、メールアドレスを入力出来たか確認する
git config user.name
git config user.email
git remote -v
一覧表示をしてくれる
表示例)
origin https://github.com/konnyakuken/test.git (fetch)
origin https://github.com/konnyakuken/test.git (push)
既にあるremote originを削除したい場合は
git remote remove origin
で削除
error: unknownが出ている場合は
git remote remove origin
と最後まで書いてあげる
最初にaddをする時はgit add .と書く
pushをする方法
何回も実行する所
今の状態を知りたい時はgit statusを打つ
git add -A
でaddをする(all)
commit
git commit -m "コメント文"
pushの方法
git push origin master
以降繰り返しでpush出来る
注意!!
Unityで使用するときは
一度に送るデータを制限するために以下のコードを書いたものをファイル内に置いておく
touch .gitignoreでファイル作成→https://github.com/github/gitignore/blob/master/Unity.gitignore
を写す(VScodeなどのエディターを使うとよい)
以下初めて実行したときの画像
(困った時はココを見る!)
https://gyazo.com/9e6d5d2cdaf754f8f3631ac709ab84e5
https://gyazo.com/8f34a484dd65034d89858283d87eb7fe
https://gyazo.com/2706fc0eeef1a7d40cf12730e83083a5
https://gyazo.com/93d6d5c05bb30afac3f4216668d4f279
code:リンクを開くのが手間な人用
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
/Llibrary/
/Ttemp/
/Oobj/
/Bbuild/
/Bbuilds/
/Llogs/
/UuserSsettings/
# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/MmemoryCaptures/
# Asset meta data should only be ignored when the corresponding asset is also ignored
!/Aassets/**/*.meta
# Uncomment this line if you wish to ignore the asset store tools plugin
# /Aassets/AssetStoreTools*
# Autogenerated Jetbrains Rider plugin
/Aassets/Plugins/Editor/JetBrains*
# Visual Studio cache directory
.vs/
# Gradle cache directory
.gradle/
# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db
# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta
# Unity3D generated file on crash reports
sysinfo.txt
# Builds
*.apk
*.aab
*.unitypackage
# Crashlytics generated file
crashlytics-build.properties
# Packed Addressables
/Aassets/AaddressableAassetsDdata/*/*.bin*
# Temporary auto-generated Android Assets
/Aassets/SstreamingAssets/aa.meta
/Aassets/SstreamingAssets/aa/*