smart
smart

Reputation: 2065

Can I change the logged in user in GIT to work with the same repositories?

I'm using a few different git accounts for public and private repositories.

Not I'm trying to clone a private repository, but

git clone https://git.... .git

returns an error:

remote: Repository not found.

But my URL is good enough (with saved case). I've just copied this from github.

I expected to enter my git username and password for a user who has enough of permissions for this private repository.

I've tried also:

ssh -T [email protected]

This returns:

Hi <username_without_access_to_expected_repo>! You've successfully authenticated, but GitHub does not provide shell access.

I was also trying to set current SSH key from my machine to private repository, but it told me that this key is already using.

So, is it possible to clone my private repository with the expected user?

I was looking for something like:

git login

But this command doesn't exist.

P.S. I've set my

git config --global user.name
git config --global user.email

for a user with expected username and email who has enough of permissions.

Upvotes: 1

Views: 74

Answers (3)

VonC
VonC

Reputation: 1323523

Regarding your https issue (repo not found), check the value of git config credential.helper.
If you see "manager" or "osxkeychain", that means your credentials (GitHub username/password) are cached.
You need to remove/update them first, before trying your git clone again.
Remove or update them on Windows or on Mac.

Upvotes: 2

smart
smart

Reputation: 2065

As a temporary fix I've used the following command:

git clone https://<username>:password@git....

Upvotes: 0

serdroid
serdroid

Reputation: 166

you are trying to clone from https. but after you test connection with ssh. possibly you put your ssh key to both public and private repos. try remove ssh key from private repo and try again.

Upvotes: 0

Related Questions