GitHub初学(三)

github使用上的一些报错:

 报错:

$ git push origin master
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

解决:

git remote add origin [email protected]:xxxxx/xx.git

报错:

git add xxx
fatal: Unable to create 'D:/spring/.git/index.lock': File exists.

Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.

解决:

找到D:/spring/.git/index.lock,并删除

报错:

git push origin master
To github.com:2637977081/Spring.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:2637977081/Spring.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

解决:

1、丢弃远程修改
git push -u origin master -f

2、丢弃本地
git fetch --all    //直接下载远程
或
git reset --hard origin/master    //head指向origin/master

猜你喜欢

转载自blog.csdn.net/qq_34819372/article/details/82382451