上传项目到github(及常见问题解决)

Git的基本使用: init--->add--->commit--->romete(创建远程仓库)--->push

1、git init vn # vn 为文件夹 2、 cd vn 3、 echo 'vn is good man 1' > README.MF #创建文件README.MF

4、git status # 下面文字代表---文件在暂存区,还没有提交     On branch master     No commits yet     Changes to be committed:     (use "git rm --cached <file>..." to unstage)    new file: README.MF
6、git add README.MF   #将文件放入暂存区  (git  add  -A  表示:将所有文件放入暂存区)
7、git rm --cached README.MF  #将文件从暂存区移除

8、git commit  README.MF -m 'first  commit' #将文件从暂存区提交到本地git仓库

  *** Please tell me who you are.  报这个错使用

  git config --global user.email "you@example.com"

  git config --global user.name "Your Name"

 

  9、git remote add origin https://github.com/avansu/vnone.git  # 给远程地址起名:origin  (解除远程关联:git remote remove origin)

 10、git push origin   

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

  git push --set-upstream origin master   执行此行命令

  

 11、git push --set-upstream origin master

  fatal: unable to access 'https://github.com/avansu/vnone.git/': OpenSSL SSL_      read: Connection was reset, errno 10054

  git config --global http.sslVerify "false"   执行此行命令

 

错误解决:

错误一:

fatal: helper error (-1): User cancelled dialog.
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: Authentication failed for 'https://github.com/avansu/vnone.git/'


以上需要去Github中,创建token,提交的时候,使用token提交

 错误二:

对于error: failed to push some refsto‘远程仓库地址’

1、使用如下命令
git pull --rebase origin master

2、然后再进行上传:

git push -u origin master

 

解决问题:

解决一:

 token直接添加远程仓库链接中,这样就可以避免同一个仓库每次提交代码都要输入token

 git remote set-url origin https://<your_token>@github.com/<USERNAME>/<REPO>.git

例子:

  git remote set-url origin https://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@github.com/avansu/vnone.git

 

posted @ 2022-02-27 15:09  VNone  阅读(631)  评论(0)    收藏  举报