git操作是出现Username for 'https://github.com':的验证问题

Username for 'https://github.com': 输入的是github上的邮箱账号, 而不是github中设置的username, 这是个巨坑!!!
Password for 'https://你的github邮箱@github.com': 输入github的登录密码,点击enter键即可.

~/github/ZYCycleViewSwift/ master: git push --set-upstream origin master
Username for 'https://github.com': 1512450002@qq.com
Password for 'https://1512450002@qq.com@github.com':
Counting objects: 14, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (14/14), done.
Writing objects: 100% (14/14), 1.88 KiB | 1.88 MiB/s, done.
Total 14 (delta 9), reused 0 (delta 0)
remote: Resolving deltas: 100% (9/9), completed with 7 local objects.
To https://github.com/ios-zhouyu/ZYCycleViewSwift
7846400..e90cd3d master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
1
2
3
4
5
6
7
8
9
10
11
12

————————————————
版权声明:本文为CSDN博主「上进求知,认真思辨」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/kuangdacaikuang/article/details/90146891

 

 

 

使用git push origin master是出现如下问题;

Username for 'https://github.com':

解决办法:

git remote set-url origin git+ssh://git@github.com/username/reponame.git

转载于:https://www.cnblogs.com/huangxingyuan/p/6492716.html

 

 

 

 

 

git remote set-url命令修改remote URL

git remote set-url传递两个参数

  • remote name。例如,origin或者upstream
  • new remote url。例如,git@github.com:USERNAME/OTHERREPOSITORY.git

 

例如:从SSH切换到HTTPS的远程URL

  1. 打开终端
  2. 切换到你项目的工作目录
  3. 列出remotes,是为了得到你想要改变的remote的名字
    xxxxxx@xxxxxx:~/workspace/goal$ git remote -v
    origin    git@github.com:xxxxxx/SpringBoot.git (fetch)
    origin    git@github.com:xxxxxx/SpringBoot.git (push)
  4. 使用git remote set-url命令从SSH到HTTPS的远程URL
    xxxxxx@xxxxxx:~/workspace/goal$ git remote set-url origin https://github.com/xxxxxx/SpringBoot.git
  5. 验证是否改变成功
    xxxxxx@xxxxxx:~/workspace/goal$ git remote -v
    origin    https://github.com:xxxxxx/SpringBoot.git (fetch)
    origin    https://github.com:xxxxxx/SpringBoot.git (push)

     

 

 

 

 

 

 

Changing a remote's URL

The git remote set-url command changes an existing remote repository URL.

Tip: For information on the difference between HTTPS and SSH URLs, see "Which remote URL should I use?"

The git remote set-url command takes two arguments:

  • An existing remote name, for example, origin
  • A new URL for the remote, for example:
    • https://github.com/USERNAME/REPOSITORY_2.git if you're updating to use HTTPS
    • git@github.com:USER/REPOSITORY_2.git if you're updating to use SSH

Switching remote URLs from SSH to HTTPS

  1. Open Terminal (for Mac and Linux users) or the command line (for Windows users).
  2. Change the current working directory to your local project.
  3. List your existing remotes in order to get the name of the remote you want to change.

    $ git remote -v
    # origin  git@github.com:USERNAME/REPOSITORY.git (fetch)
    # origin  git@github.com:USERNAME/REPOSITORY.git (push)
    
  4. Change your remote's URL from SSH to HTTPS with the remote set-url command.

    $ git remote set-url origin https://github.com/USERNAME/REPOSITORY_2.git
    
  5. Verify that the remote URL has changed.

    $ git remote -v
    # Verify new remote URL
    # origin  https://github.com/USERNAME/REPOSITORY2.git (fetch)
    # origin  https://github.com/USERNAME/REPOSITORY2.git (push)
    

  The next time you git fetchgit pull, or git push to the remote repository, you'll be asked for your GitHub username and password.

Switching remote URLs from HTTPS to SSH

  1. Open Terminal (for Mac and Linux users) or the command line (for Windows users).
  2. Change the current working directory to your local project.
  3. List your existing remotes in order to get the name of the remote you want to change.

    $ git remote -v
    # origin  https://github.com/USERNAME/REPOSITORY.git (fetch)
    # origin  https://github.com/USERNAME/REPOSITORY.git (push)
    
  4. Change your remote's URL from HTTPS to SSH with the remote set-url command.

    git remote set-url origin git@github.com:USERNAME/REPOSITORY2.git
    
  5. Verify that the remote URL has changed.

    $ git remote -v
    # Verify new remote URL
    # origin  git@github.com:USERNAME/REPOSITORY2.git (fetch)
    # origin  git@github.com:USERNAME/REPOSITORY2.git (push)

 

相关文章

developer-roadmap —— 提供最全的开发者技术路线指南。前端...
一个极简的文件分享工具,无需注册且没有广告即可生成共享下...
收集 Github、Gitee优秀的开源项目,并进行归类整理。项目地...
大家好,我是 Java陈序员,我们有时会搭建一个属于自己的网站...
一个提供交互式的Web UI用于生成兼容MyBatisPlus框架的相关功...
大家好,我是 Java 陈序员。权限认证是我们日常开发绕不过的...