我的 GitHub 存储库与我桌面上的代码不同步(请参阅附件 1)。所以我需要将我的桌面代码推送到 GitHub。我找到这篇文章:https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/How-to-git-push-an-existing-project-to-Bitbucket 。在 GitHub Desktop 中,我打开“存储库 --> 在命令提示符中打开”并执行以下操作:
cd D:\Award Tracking Application - restart 20240407\Award Tracking Application
D:
git init
git add .
git config --global user.email "[email protected]"
git config --global user.name "xxxxxxxxxxxr"
git commit -m "Add files to git before the Bitbucket push."
git remote add source https://[email protected]/ATA_Team/gmat.git
git push -u -f bitbucket master
推送返回错误:
致命:“bitbucket”似乎不是 git 存储库 致命:无法从远程存储库读取。
请确保您拥有正确的访问权限 并且存储库存在。
于是我回到GitHub Desktop进行推送(见附件2)。然而,这给出了一条错误消息,我需要先执行获取(参见附件 3)。所以我点击了“获取”。然后重试发布。但是,显示了我需要先执行获取的相同错误消息。
更换:
git push -u -f bitbucket master
与
git push -u -f source master