git - 将现有代码推送到 VSTS 时我做错了什么
问题描述
我已经准备好用于将 Visual Studio 解决方案推送到 VSTS 的 PowerShell 脚本。
不幸的是,这发生在几周前,现在我不记得我使用了什么命令。只有我有 Powershell ISE 的输出窗口:
(以 +++ 开头的行是我今晚分析时可能使用的命令)
+++git init
Reinitialized existing Git repository in D:/Documents/Visual Studio 2017/C++_Projects/Mira_kompilator/.git/
Removing .gitignore
Removing Code/
Removing Dokumentace/
Removing Helpful stuff/
+++
git : fatal: pathspec '*' did not match any files
At line:6 char:1
+ git add *
+ ~~~~~~~~~
+ CategoryInfo : NotSpecified: (fatal: pathspec...match any files:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
On branch master
+++git commit
Initial commit
nothing to commit
+++git push
git : error: src refspec refs/heads/master does not match any.
At line:8 char:1
+ git push -f
+ ~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (error: src refs... not match any.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
error: failed to push some refs to 'https://.visualstudio.com/_git/Mira_kompilator'
非常感谢!
解决方案
看起来您的脚本删除了所有文件,然后没有添加任何文件(因为文件已经消失),因此无法提交。
确保首先手动在新的克隆存储库中尝试它(意味着没有 Powershell 脚本)以确保它正常工作。
使用 git add 。而不是 git add *.
并确保您的远程仓库 URL 正确(https://.visualstudio.com
看起来很奇怪)
然后克隆你的远程仓库:
cd /path/to/local/clone
# modify some files
git add .
git commit -m "first commit"
git push
推荐阅读
- excel - 复制范围并在循环中相乘
- javascript - Auth0:获取用户组的数据
- math - 我应该怎么做才能在 Octave 上绘制小波?
- dask - 从 Dask 数组中选择多个切片的最佳方法
- jpa - 在使用 EclipseLink 的构造函数表达式中使用 NULL 时出现 NullPointerException
- java - Android MediaRecorder kotlin 以更好的质量录制视频
- php - 替换 PHP 中的字符串 - 不适用于更长的字符串
- excel - 调用方法或确定方法是否有效/存在?
- mysql - 如何向 MariaDB 中的现有 JSON 对象添加新对象?
- c# - 用于在表中存储日期的字符串由于未知原因正在转换 int