简体   繁体   English

无法将提交从本地分支推送到github存储库

[英]Can't to push commits from local branch to github repository

I was committing and pushing in ordinary for my repository. 我一直在为自己的存储库提交和推送普通文件。 but once i used command of git checkout for change to the previous version of my repository. 但是一旦我使用git checkout命令更改到我的存储库的先前版本。 after that i tried to commit and push, then it can not completed. 之后,我尝试提交并推送,则无法完成。

i try to use the --no-verify command to push the commit but it also not success. 我尝试使用--no-verify命令来推送提交,但也没有成功。

error: failed to push some refs to 'https://github.com/ruwanliyanage123/Hair-4-U-Hospital.git'

i want to push my commit into github repository 我想将我的提交推送到github仓库中

Try to first check in which branch you are working do git branch, check is the one you are working. 尝试首先检查您在哪个分支中执行git branch,检查是您正在使用的那个分支。 Then I sometimes do git pull to just make sure that the connection is working this should not delete your progress the you should be able to do git push. 然后我有时会做git pull来确保连接正常,这不会删除您的进度,您应该能够进行git push。 If you are afraid youll mess up first do a local back up of all project files except for the .git one which are hidden by default in windows.Lastly I would suggest never posting the actual link to your github repository in case whatever you are working is important, you can just replace with https://github.com/user/projectname.git 如果您担心自己搞砸了,请对所有项目文件进行本地备份,但默认情况下Windows中隐藏的.git文件除外。很重要,您可以替换为https://github.com/user/projectname.git

Since you switched to a previous version of your repository, your head is most probably detached. 由于您切换到存储库的先前版本,因此您的头很可能已脱离。 You can't just go back anywhere in your history and make commits. 您不仅可以返回历史记录中的任何位置并进行提交。 Consider making a branch from there and then commit to it. 考虑从那里建立一个分支,然后提交给它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM