GitHub问题总结

1. 打开Git Bash:

2.命令行-初始化本地仓库:

 $ git init 

3. 将目录下所有文件添加到本地仓库

$ git add .

4.将添加的文件提交到本地仓库:

$ git commit -m"first commit"

5. 与Github上新建的远程仓库建立链接:

$ git remote add origin https:****

6. 把文件push到远程仓库:

$ git push -u origin master

------------------------------------------------------

遇到的问题1:error: remote origin already exists.
问题定位: git  remote -v

origin  https://github.com/* (fetch)
origin  https://github.com/* (push)
https://w​​​​​​ww.coder.work/article/1536836

问题2:$ git push -u origin master
error: src refspec master does not match any
error: failed to push some refs to 'https://github.com/ZZhaipei/cit693.git'

git status

On branch main
nothing to commit, working tree clean
 

问题3:

fatal: The current branch main has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin main
 

问题4:

$ git push origin master
error: src refspec master does not match any
error: failed to push some refs to 'https://github.com/ZZhaipei/cit693.git'
 

解决: 

$ git push --set-upstream origin main
Enumerating objects: 116, done.
Counting objects: 100% (116/116), done.
Delta compression using up to 8 threads
Compressing objects: 100% (108/108), done.
Writing objects: 100% (116/116), 726.13 KiB | 6.31 MiB/s, done.
Total 116 (delta 19), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (19/19), done.
To https://github.com/*****
 * [new branch]      main -> main
Branch 'main' set up to track remote branch 'main' from 'origin'.

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值