Dar*_*oN1 28 git visual-studio-code
我用Visual Studio Code 创建了一个本地项目,该项目实现了一个本地GIT存储库.
然后我在Visual Studio Online上创建了一个GIT存储库,我希望将所有项目文件推送到远程存储库...
这样做的正确程序是什么?
我这时的.git\config文件看起来像这样:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
Run Code Online (Sandbox Code Playgroud)
感谢支持
Chr*_*oph 63
我假设你开始在一个目录中工作,并没有在那里使用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...
Run Code Online (Sandbox Code Playgroud)
要添加遥控器,只需这样做
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.
Run Code Online (Sandbox Code Playgroud)
所述-u套的上游参考和git知道从哪里fetch/ pull和在哪里push的未来.
现在可以在不键入命令行的情况下从VS Code设置原点:
git remote add origin https://github.com/USR/REPO.git
Run Code Online (Sandbox Code Playgroud)
在VS Code中,如果您使用的是Windows,则可以CTRL+ SHIFT+ 。Premote
从那里选择,Git: Add Remote然后您将有两个步骤:
origin为远程名称:originURL:https : //github.com/USR/REPO.git来自评论:
VSCode 不支持其 UI 中的“添加远程”操作(2018 年 4 月)
实际上,从Visual Studio Code 1.46(2020 年 5 月)开始就是这样:
从 GitHub 添加远程
现在,您可以使用 Git: Add Remote... 命令轻松将 GitHub 存储库作为远程存储库添加到本地存储库。
| 归档时间: |
|
| 查看次数: |
46176 次 |
| 最近记录: |