うまく説明出来ないのだけれど…
ローカルで作ったリポジトリをgithubに初めてpushする方法
通常の流れ
- GitHubでレポジトリ作成
- git clone
- ローカルでコードをごにょごにょしてコミット
- git push
1. ローカルでレポジトリ作成
$ git init $ git add . $ git commit -m "This is 1st commit"
2. GitHubでレポジトリ作成
(これは普通にGitHubから)
3. リモートリポジトリを追加する(たぶんココが肝)
ローカルでリポジトリを作ったけど、このままだとgit pushしても
「どこのリポジトリにpushしようとしてるの?」
となるので、以下のコマンドを実行してリモートを指定する。
$ git remote add origin git@github.com:user-name/repository
user-nameとrepositoryは適当に。
FYI:
transitive.info - git remote 使い方
リモートリポジトリを加える URL が url の名前 remote-name のリモートリポジトリを加えるには git remote add remote-name url
4. GitHubのリポジトリをローカルに引っぱる
(そのままgit pushしようとすると
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
ってなるから↓のようにしないといけない。
$ git fetch $ git merge origin/master $ git push
それで作ったのがこのソースコードです。
shigemk2/.tmux.conf · GitHub