git - I already have 1 code commit account set up, how do I set up a second code commit account? (I'm getting a clone error on the second account)
问题描述
When I try and clone a new code commit repo on my MAC I get a 403 error. I'm completely lost as to what I need to do to get 2 different accounts to work.
When I run git config -l --show-orgin I have these settings.
$ git config -l --show-origin
file:/Library/Developer/CommandLineTools/usr/share/git-core/gitconfig credential.helper=osxkeychain
file:/Users/username/.gitconfig user.email=firstnamelastname@company.com
my .aws/credentials file contains the following from the first account
[default]
aws_access_key_id=xxxxxx
aws_secret_access_key=xxxxxxxxxxxxxxxx
my credential-helper.sh. file contains from the first code commit account
echo username="[xxxxxxxx]"
echo password="[xxxxxxxxxxxxx]"
I'm new to code commit and am not sure what I need to edit in order to clone the second repo.
When I do try and clone into it, I get the below error:
fatal: unable to access 'https://git-codecommit.xxxxxxxxx/v1/repos/xxxxxxxx/': The requested URL returned error: 403
What am I missing here? We haven't set up ssh on the second account yet and are just using a username and password for the time being.
解决方案
If you want your credential-helper.sh
to be used by your second repo (as described in this article), you would need to:
- initialize an empty repo locally
- add a local setting instructing to use that credential
- add a remote to the remote repo
- fetch
That is:
git init .
git config credential.helper "/bin/bash /full/path/to/credential-helper.sh"
git remote add origin https://git-codecommit.xxxxxxxxx/v1/repos/xxxxxxxx/
git fetch
git switch master
推荐阅读
- scala - Scala:如何设计高阶函数?
- python - 将队列传递给python中的看门狗线程
- angularjs - 带有encodeURIComponent的AngularJS过滤器在链接中不起作用
- aws-lambda - 允许云手表调用 serverless lambda
- lua - math.random(1, 100) 只给我小数
- python - 使用 python 在远程 FTP 服务器上将文件移动到另一个文件夹的可能性
- nativescript - 登录返回未定义的 peekState 错误
- python - django-select2 公开 ajax 端点供外部使用
- java - Java Regex FileName 不重复
- java - HikariCP 的默认最大池大小