0
点赞
收藏
分享

微信扫一扫

Liunx shell编程及自动化运维实现--第三章循环

代码敲到深夜 2024-01-31 阅读 14
github

1.点击 github头像       :

setting         ->    

Developer Settings        ->      

Personal access  tokens 

2.在要上传的文件夹下运行以下命令:

git init
git commit -m "first commit"
git branch -M main

 利用以下命令模板(根据自己的信息填写):

git remote set-url origin https://<token>@github.com/<username>/<repo>

模板分析(需要修改的部分):

<token>        :刚才生成的个人令牌
<username>:你的github名字
<repo>        : 存储库的名字

再运行:

git push origin main

成功: 

报错(1):

remote: Permission to samrao2/manager-4.git denied to samrao1.
fatal: unable to access 'https://github.com/samrao2/manager-4.git/': The requested URL returned error: 403

解决方式

(1):Token未给出权限,需要勾选权限:

 

之后使用token再试一次

(2):

  1. 从(Windows)凭据管理器中删除所有GitHub条目

  2. 在Git全局配置中设置useHttpPath = true

git config --global credential.useHttpPath true

您可以通过检查

git config --global -e

若名字错误可以进行修改(自己改):

git config --global user.name "user_name"

 

举报

相关推荐

0 条评论