马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
1. 标题
在使用 git push -u origin main 下令推送长途分支时要求输入用户名和暗码,详细操纵如下所示:- (base) localhost:profile-platform wy$ git branch -M main
- (base) localhost:profile-platform wy$
- (base) localhost:profile-platform wy$ git remote add origin https://github.com/sjf0115/profile-platform.git
- (base) localhost:profile-platform wy$
- (base) localhost:profile-platform wy$ git push -u origin main
- Username for 'https://github.com':
复制代码 2. 办理方案
缘故起因是在添加长途库的时间使用了 https 的方式。以是使用的 https 的方式 push 到长途库。只必要重新设置成 ssh 的方式即可:- (base) localhost:profile-platform wy$ git remote add origin [email protected]:sjf0115/profile-platform.git
- (base) localhost:profile-platform wy$
- (base) localhost:profile-platform wy$ git push -u origin main
- Enumerating objects: 21, done.
- Counting objects: 100% (21/21), done.
- Delta compression using up to 4 threads
- Compressing objects: 100% (12/12), done.
- Writing objects: 100% (21/21), 8.17 KiB | 1.63 MiB/s, done.
- Total 21 (delta 0), reused 0 (delta 0), pack-reused 0
- To github.com:sjf0115/profile-platform.git
- * [new branch] main -> main
- branch 'main' set up to track 'origin/main'.
复制代码 如下图所示有 https 和 ssh 两种方式,我们选择 ssh 方式即可:
|