Visual Studio Codeで、ローカルGITリポジトリを実装したローカルプロジェクトを作成しました。
そして、Visual Studio OnlineにGITリポジトリを作成し、すべてのプロジェクトファイルをリモートリポジトリにPUSHしたいのですが、どうすればよいでしょうか?
どのような手順で行うのが正しいのでしょうか?
この時の私の.gitconfigファイルは以下のような感じです:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
サポートに感謝
あるディレクトリで作業を開始し、そこでgitを使わなかったと仮定します。以下は、git bashで動作するはずです:
cd "path to your repo"
git init
git add . # if you want to commit everything. Otherwise use .gitconfig files
git commit -m "initial commit" # If you change anything, you can add and commit again...
リモコンを追加するには、次のようにします。
git remote add origin https://...
git remote show origin # if everything is ok, you will see your remote
git push -u origin master # assuming your are on the master branch.
uは上流への参照を設定し、git はどこから
fetch/
pullするか、そして将来的にどこから
push` するかを知ることができます。
コマンドライン入力なしで、VS Codeからオリジンを設定することができるようになりました:
git remote add origin https://github.com/USR/REPO.git
VS Codeの中で、Windowsであれば、 CTRL+SHIFT+P で、remote
と入力します。
そこからGit.Add Remote
を選択します:Add Remote`を選択すると、2つのステップになります:
origin
を設定します:origin
を追加する URL: https://github.com/USR/REPO.git