facebook twitter hatena line email

「Git/github」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(100MB以上のファイルをpushしたときのエラー対応方法)
 
(同じ利用者による、間の20版が非表示)
行1: 行1:
==セットアップ==
+
[[git/github/基本]]
#[[git/windowsインストール]] [ショートカット]をまずやる
+
#githubのアカウントを作成
+
#ssh public keysでkeyにid_ssh.pubのテキストデータを入れる(タイトルは適当に
+
#Git Bashで以下コマンドを実行しconnection~成功と出ればOK
+
$ ssh git@github.com
+
#ユーザ名、メアド設定
+
$ git config --global user.name "自分のユーザー名"
+
$ git config --global user.email "自分のメアド"
+
  
==リポジトリ作成==
+
[[git/github/プルリクtemplate]]
#右中の[New repository]ボタンをクリック
+
  
==自分のレポジトリについて他人に権限を与える==
+
[[git/github/プルリク]]
# repositoryのsettings/collaborationでusernameを追加する
+
# username側にinvitedメールが行くのでリンクをクリックしてもらう。
+
  
==初回コミット方法==
+
[[git/github/大きなファイル]]
mkdir hellogithub
+
cd hellogithub
+
git init
+
touch hello.txt
+
git add hello.txt
+
git commit -m 'first commit'
+
git remote add origin git@github.com:[user1]/[project1]
+
git push -u origin master
+
  
==フォーク解除==
+
[[git/github/自動デプロイ]]
admin/Delete this repository
+
  
==フォークして本体にマージする==
+
[[git/github/gui]]
# fork元にあるレポジトリのforkボタンを押す
+
# 自分のレポジトリにforkしたプロジェクトができる
+
# (任意)自分のプロジェクトにブランチを作成する
+
# (任意)作成したブランチでファイルを変更しpushする
+
# 自分のブランチから本体側にプルリクを出す(出せない場合はレポジトリ権限がない場合があるので見直す)
+
# 本体側でプルリクマージボタン押すと本体側にマージされる
+
  
==リポジトリコピーからのコミット(ちょっと違うがsvnでいうチェックアウトなイメージ==
+
[[git/github/actions]]
git clone git@github.com:[user1]/[project1] [project1]
+
cd project1
+
git add hello.txt
+
git commit -m 'hellodesu'
+
git push
+
  
注:コメントがないと怒られます。
+
[[git/github/複数アカウント]]
  
==ファイル削除==
+
[[git/github/draft]]
git delete hello.txt
+
  
==ファイル2回目以降コミット==
+
[[git/github/通知]]
git add -u
+
git commit -m 'adddesu'
+
git push
+
 
+
==ファイル最新に==
+
git pull
+
 
+
==コマンド一覧==
+
http://sourceforge.jp/magazine/09/03/16/0831212
+
 
+
==リリースを作成する==
+
タグでバージョンを作る
+
$ git tag -a v.1.0.0
+
タグ確認
+
$ git tag
+
v.1.0.0
+
タグをgithubへpush
+
$ git push origin v.1.0.0
+
# github.com側のreleaseページに移動
+
# v.1.0.0が存在することを確認
+
# "Draft a new release"ボタンを押す
+
# 画面のtag versionとtitleに"v.1.0.0"を入力
+
# 適切な変更点を下の欄に入れる
+
 
+
==2段認証をonに==
+
#githubの管理画面
+
#Account Settings/Set up tow-factor authentication
+
 
+
QRコード認証であれば
+
#Set up using an app
+
 
+
SMS認証であれば
+
#Set up using SMS
+
 
+
 
+
==Permission denied (publickey).エラーが出る場合==
+
sshの公開鍵がgithubのuserアカウントに登録されているか確認。
+
*ssh公開鍵を登録する(https://github.com/settings/ssh
+
 
+
==Username for 'ttps://github.com':が出る場合==
+
remoteのurlがhttps担っている場合はsshに切り替える
+
 
+
==githubのwikiに画像を追加==
+
例:helloworld.gitのwikiに画像を追加したい場合、以下imagesに追加する
+
$ git clone git@github.com:user1/helloworld.wiki
+
ls helloworld.wiki/images
+
+
参考:http://www.pupha.net/archives/1632/
+
 
+
==githubドメイン向けrsaの作り方==
+
$ ssh-keygen -t rsa
+
~/.ssh/github_id_rsa
+
$ vi ~/.ssh/config
+
Host github.com
+
  HostName github.com
+
  IdentityFile ~/.ssh/github_id_rsa
+
  User user1
+
$ chmod 600 ~/.ssh/config
+
 
+
==githubをwindowで使う==
+
参考:http://wp.graphact.com/2011/02/07/github-windows-2011/
+
 
+
==100MB以上のファイルをpushしたときのエラー対応方法==
+
remote: error: GH001: Large files detected. You may want to try Git Large File Storage
+
 
+
Git LFS のインストール(macであれば)
+
brew install git-lfs
+
 
+
.gitattributesに100MB超えのファイルを追加(例:hogehoge/Libraries/libil2cpp.a)
+
$ git lfs track hogehoge/Libraries/libil2cpp.a
+
$ cat .gitattributes # 確認
+
hogehoge/Libraries/libil2cpp.a filter=lfs diff=lfs merge=lfs -text
+
 
+
ファイルをaddしpushする
+
git add .gitattributes
+
git push origin master
+
 
+
対象ファイルを```git log```してgitattributes登録前にファイルをcommitしている箇所があれば失敗するので、以下のようなロールバックですべて戻す必要がある
+
git reset --soft HEAD^
+
 
+
参考:https://qiita.com/kanaya/items/ad52f25da32cb5aa19e6
+

2022年11月23日 (水) 19:57時点における最新版

git/github/基本

git/github/プルリクtemplate

git/github/プルリク

git/github/大きなファイル

git/github/自動デプロイ

git/github/gui

git/github/actions

git/github/複数アカウント

git/github/draft

git/github/通知