git clone 私有项目

在clone的时候,在https://后面先加上github-username:github-token,再@项目的链接即可把项目clone下来。

  • GitHub:加的是token;(Token设置:设置Token
  • Gitee:加的是password;
git clone https://github-username:github-password@github.com/username/project.git
  • example:kyrle是我的用户名
git clone https://kyrle:abcdefg@gitee.com/kyrle/somethingyoulike.git

设置密码不用反复输入

http
git remote set-url origin https://<your_token>@github.com/<USERNAME>/<REPO>.git
ssh
# ssh不需要设置密钥,通过ssh key即可
git remote set-url origin git@github.com:<USERNAME>/<REPO>.git
# eg: git remote set-url origin git@github.com:myname/my_repo.git

如果ssh无反应则尝试:ssh -Tv git@github.com,可以打印log。

参考文章:

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐