Xsm*_*ael 39 git github visual-studio-code vscode-settings
我到目前为止看到的所有教程都显示首先在github上创建一个存储库,将链接复制到vscode,git clone
然后从那里开始,你可以做提交和推送.
这是正确的方法吗?我不能只从vscode启动一个项目,然后将其上传到我的git?
Vik*_*m K 75
以下是实现此目的所需的详细步骤.
可以通过VS-CODE的CLI终端简单地运行现有命令.据了解,Git安装在系统中,配置了所需的用户名和电子邮件ID.
1)导航到本地项目目录并创建一个本地git存储库:
git init
Run Code Online (Sandbox Code Playgroud)
2)一旦成功,单击VS- Code中左侧导航栏上的"Source Control"图标.One应该能够看到准备提交的文件.按"提交"按钮,提供注释,暂存更改并提交文件.或者,您可以从CLI运行
git commit -m "Your comment"
Run Code Online (Sandbox Code Playgroud)
3)现在您需要访问您的GitHub帐户并创建一个新的存储库.排除创建"README.md",".gitIgnore"文件.也不要向repo添加任何许可证.有时这些设置会在推入时导致问题.
4)将链接复制到这个新创建的GitHub存储库.
5)在VS-CODE中返回终端并连续输入以下命令:
git remote add origin <Link to GitHub Repo> //maps the remote repo link to local git repo
git remote -v //this is to verify the link to the remote repo
git push -u origin master // pushes the commit-ed changes into the remote repo
Run Code Online (Sandbox Code Playgroud)
注意:如果这是本地git帐户第一次尝试连接到GitHub,则可能需要在单独的窗口中输入GitHub的凭据.
6)您可以在终端中看到成功消息.您还可以通过在线刷新GitHub仓库进行验证.
希望这可以帮助
dog*_*dog 28
启动命令面板Ctrl+Shift+P
,运行Publish to Github
,然后按照提示操作。您将可以在私有和公共存储库之间进行选择,因此请注意选择正确的存储库。
它可能会要求您登录 github。然后它会提示输入 repo 名称(默认为文件夹的名称),以及创建 .gitignore 文件(默认为空 .gitignore)。如果您对默认设置没问题,只需按 Enter 键即可。完成后,它应该会在右下角给您一个弹出通知,其中包含一个指向 repo 的链接https://github.com/<username>/<reponame>
小警告:如果您的项目中已经有一个 .gitignore 文件,此过程将覆盖它
Deb*_*obi 14
嗯,这很容易。
打开您的本地项目。
添加README.md
文件(如果您还没有要添加的内容)
点击 Publish on Github
随心选择
选择要包含在首次提交中的文件。
注意:如果您不选择文件或文件夹,它将添加到.gitignore
文件
你已准备好出发。它已发布。
PS 如果这是你第一次。提示将要求您提供 Github 凭据,然后您就可以开始了。它已发布。
Sau*_*abh 10
在您的PC上安装git并在命令提示符(cmd)或VS Code终端(Ctrl + `
)中设置配置值
git config --global user.name "Your Name"
git config --global user.email youremail@domain.com
Run Code Online (Sandbox Code Playgroud)
设定编辑器
Windows例如:
git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -nosession"
Run Code Online (Sandbox Code Playgroud)
Linux / Mac,例如:
git config --global core.editor vim
Run Code Online (Sandbox Code Playgroud)
检查显示配置详细信息的git设置
git config --list
Run Code Online (Sandbox Code Playgroud)
登录到github并创建一个远程存储库。复制此存储库的URL
导航到您的项目目录并执行以下命令
git init // start tracking current directory
git add -A // add all files in current directory to staging area, making them available for commit
git commit -m "commit message" // commit your changes
git remote add origin https://github.com/username/repo-name.git // add remote repository URL which contains the required details
git push -u origin master // publish changes to your remote repository
Run Code Online (Sandbox Code Playgroud)
小智 10
在 VS Code 中将代码推送到 git hub
git init
git add .
git commit -m " test this app"
git remote add origin https://github.com/username/flutterapp.git
git push or
git push --set-upstream origin master
Run Code Online (Sandbox Code Playgroud)
小智 7
创建一个新的 GitHub 存储库。
转到 VS code 中的命令行 (ctrl+`)。
键入以下命令:
git init
git commit -m "first commit"
git remote add origin https://github.com/userName/repoName.git
git push -u origin master
Run Code Online (Sandbox Code Playgroud)
今天是2020 年 12 月 25日,我的 VSC 是1.52.1,尝试以上所有方法都不太成功。以下是我使用 VSC 将现有本地项目添加到 GitHub 的完整步骤(注意:不要在 GitHub 上创建相应的存储库):
<your username>/<your new repository name>
. 例如,我的用户名是“myname”,我的本地文件夹被命名为“HelloWorld”。因此,它将myname/HelloWorld
在输入框中。 归档时间: |
|
查看次数: |
55865 次 |
最近记录: |