[英]GitHub repository created but unable to upload VS solution
I tried uploading a C++ project from Visual Studio 2019 onto my GitHub account.我尝试将 C++ 项目从 Visual Studio 2019 上传到我的 GitHub 帐户。
The repository gets created when I do this however, none of my codes gets uploaded onto the repository.但是,当我这样做时会创建存储库,但我的代码都不会上传到存储库中。
Only the files ".gitattributes" and ".gitignore" appear in my repository.只有文件“.gitattributes”和“.gitignore”出现在我的存储库中。
Please could I have any suggestions on what I could do to fix this.请我对我能做些什么来解决这个问题有任何建议。
Close VS Go to your local repository folder (the solution folder)将 VS Go 关闭到本地存储库文件夹(解决方案文件夹)
This will add all the files and commit them这将添加所有文件并提交它们
git add .
git commit -m 'added files'
alternatively you can use "git add ___" to add one file at a time或者,您可以使用“git add ___”一次添加一个文件
Make sure you commit the changes and then do确保提交更改,然后执行
"git push" “混帐推”
Re-open VS and everything should be setup now.重新打开VS,现在应该设置一切。
Here are some other instructions I wrote down recently which you may find helpful:以下是我最近写下的一些其他说明,您可能会觉得有帮助:
How to create a git repo from an ungitted local project already in development:如何从已经在开发中的 ungitted 本地项目创建 git 存储库:
Create a empty repo on your repo hosting site在您的存储库托管站点上创建一个空存储库
Go to your local project folder in git command line Go 到 git 命令行中的本地项目文件夹
git init git 初始化
git add. git 添加。
git commit -m 'message' git 提交 -m '消息'
git remote add origin https://yourreposite.com/username/repo git 远程添加原点https://yourreposite.com/username/repo
git push -u origin master git push -u 原点主控
Now you can open it in Visual Studio and everything is all setup现在您可以在 Visual Studio 中打开它,一切都已设置完毕
I encountered the exact same issue with VS 2022 and a Xamarin.Forms solution - tried several times but only created the repository and the two files mentioned.我在 VS 2022 和 Xamarin.Forms 解决方案中遇到了完全相同的问题 - 尝试了几次,但只创建了存储库和提到的两个文件。 This answer worked a treat although it would be handy to know why VS isn't working as it should!这个答案很有效,尽管知道为什么 VS 不能正常工作会很方便!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.