0

I have a folder structure thus on my machine:

c:/officialGit/
    .git/

The output of running git config --list in c:/officialGit/ command line is:

user.email=official_email_id@gmail.com
user.name=official_user_name
remote.origin.url=https://github.com/official_user_name/officialGit.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*

Within the above folder, I created a subfolder

c:/officialGit/forPersonalPractice/

The idea of this subfolder is that I want to practice git commands using a different email id and repository (local and remote) that does not in any way corrupt/interfere with the officialGit repository (local and remote) above and vice versa.

Following answer specified here, I navigated to subfolder /forPersonalPractice/ and issued git init

Then, I issued:

git config user.name Personal_Practice_UserName
git config user.email Personal_Practice@email.com

From the same subfolder, to verify if things are correctly set up, I issued git config --list. I obtain:

user.email=official_email_id@gmail.com
user.name=official_user_name
...
user.name=Personal_Practice_UserName
user.email=Personal_Practice@email.com

That is, user.name and user.email seem to have multiple entries.

I created a private online repository whose link is https://github.com/Personal_Practice_UserName/PersonalProject.git

When I now issue git clone https://github.com/Personal_Practice_UserName/PersonalProject.git from the /forPersonalPractice/ subfolder, I obtain

Cloning into 'PersonalProject'...
remote: Repository not found.
fatal: repository 'https://github.com/Personal_Practice_UserName/PersonalProject.git/' not found

Is there a missing step or should I follow a completely different setup on this single machine where the .git/ folder of /officialGit/ and /officialGit/forPersonalPractice/ are not hierarchically nested maybe?


ETA: Running git config user.name in c:/officialGit/ returns official_user_name. Running that in c:/officialGit/forPersonalPractice/ returns Personal_Practice_UserName. Running git config credential.helper in both folders returns manager-core.

Tryer
  • 3,580
  • 1
  • 26
  • 49
  • 2
    Just to note, [`user.name` is a personal name, not a username](https://git-scm.com/docs/gitfaq#user-name). – bk2204 Jan 20 '22 at 02:39
  • @bk2204 My actual name is the official user name. For this practice, I use an anonymized username on github. That is, for this practice repository, I do not want to reveal my actual name/identity as any part of the settings (local or remote). – Tryer Jan 20 '22 at 02:48
  • 2
    There are multiple entries because they are configured in different levels. Use `git config user.name` to see which name takes effect. You could just make a test commit to see which name and email are used in the current repository. – ElpieKay Jan 20 '22 at 03:20
  • 2
    The value of `user.name` does not take part in the authentication. The clone with the http/https url uses your github username and password/token. As it did not ask you to enter them manually, some credential helper could be working. They are cached somewhere. Run `git config credential.helper` to see what it is. If the repository does exist in github, the cached account does not have access to the repository, so it complained the repository was not found. – ElpieKay Jan 20 '22 at 03:21
  • @ElpieKay I have updated the OP with the output of commands you suggest. credential.helper in both cases is `manager-core`. Should I manually change this from within `c:/officialGit/forPersonalPractice/` ? – Tryer Jan 20 '22 at 03:49
  • 1
    `manager-core` corresponds to Windows's Credential Manager. My Windows system language is not English, so I'm afraid I cannot give more advises. You can find an entry related to github in Credential Manager and find the username and password stored there. – ElpieKay Jan 20 '22 at 06:22
  • @ElpieKay yes, this helped. I was able to go into Window's credential manager and remove the default git credentials there that were corresponding to my official id. Then, when I tried to clone from the personal directory, it explicitly asks for new username and password. Once provided, I was able to go ahead and clone it. Thanks for your help. – Tryer Jan 20 '22 at 07:14

0 Answers0