I have cloned git repo with access token
git clone http://oauth2:#myrepo.git from user A on windows
and when I switch to user B and try to git pull on same repo
gives -
error: cannot open .git/FETCH_HEAD:
All I want to achieve is
user A and B should be able to pull code from myrepo.git when cloned with access-token
Related
I reviewed this answer here:
Message "Support for password authentication was removed. Please use a personal access token instead."
But I still get error
PS C:\Js Projects> git push -u origin main
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/zac/FindCommonItems.git/'
I generated a classic token with all permissions and I set it in Windows 11 credential manager like that
In VS Code when I run
git push -u origin main
I get the same error above. What I am missing?
Worked thanks to #273K like this:
Deleted .git folder
git remote set-url origin git#github.com:zac/FindCommonItems.git
git init
git add .
git commit -m "first commit"
git branch -M main
git remote add origin git#github.com/zac/FindCommonItems.git
git push -u origin main
It prompt also to authenticate from browser
Prefacing this with I am very new to git and github.
I set up a repo on github, as user zzz, and it is correctly listed in my local (repo-specific) git config file, which has entries like the following when I do 'git config --local --list':
remote.origin.url=https://github.com/zzz/myrepo.git
user.name=zzz
user.email=yyy#example.com
But when I do do git push origin master, it get 403 denied to user 'xxx'... a user which corresponds to a completely separate github account. How do I fix this? And why is it picking up user 'xxx' when that is not the user i carefully specified in the local config file? I am on windows 7 machine.
Git store credentials in Windows, clear them referring below image:
Run your git push command, it will prompt you to enter credentials again.
Image Courtesy - Remove credentials from Git
So I clone a private repo on my VPS using SSH with Git Shell. Now when I commit changes and try to push it to my VPS it says
"Sync failed: The repository doesn't seem to exist anymore. You may not have access, or it may have been deleted or renamed."
Whenever I go into Git Shell and do "git push origin master", I enter my password and it pushes it succesfully.
Why can't I do this through the Github client?
I am not very familiar with Github.
I changed my username on the web client due to security issues.
I had an Xcode project that I was committing locally and pushing to remote.
I want to push to the same remote but can't since the username is now changed. How do I modify this in Xcode/terminal?
I also want to change the local username to the same one I have on the remote. How/where can I change this
I tried checkout out one of my own GitHub projects (it's public and not that interesting but I'll use it as the example anyway).
When I go to the command line and perform git remote -v I am told:
machine:Clock-Signal user$ git remote -v
origin https://github.com/TomHarte/Clock-Signal.git (fetch)
origin https://github.com/TomHarte/Clock-Signal.git (push)
Supposing I were to change my username to HarteTom then the new remote location of my repository would become:
https://github.com/HarteTom/Clock-Signal.git
Noting that both of those locations are named as 'origin' from the first output I could perform git remote set-url origin https://github.com/HarteTom/Clock-Signal.git. I could confirm that with another git remote -v which would now say:
machine:Clock-Signal user$ git remote -v
origin https://github.com/HarteTom/Clock-Signal.git (fetch)
origin https://github.com/HarteTom/Clock-Signal.git (push)
I am on Mac OSX, git version 1.8.5.2 (Apple Git-48)
I had a git submodule in a git repo that had (to my knowledge) only ever been cloned, pulled, committed, merged and pushed using one git user and rsa key. I have many other pairs of users and keys but no others were specified in the ~/.gitconfig file.
When this submodule had the remote of https://github... etc. It would allow me to commit with the correct username and email being applied but when pushing, would tell me that:
remote: Permission to some_username/project.git denied to user2.
fatal: unable to access 'https://github.com/some_username/project.git/': The requested URL returned error: 403
However when I removed the https://... remote and instead used the git#github.com:some_username/project.git remote, it works correctly.
Is this a bug with git or github? Was there any other way to fix it? Both these users have their associated rsa keys associated on their github accounts.
Is this a bug with git or github?
No: with https url, you need to add the login in the url for git to know what credential to ask for:
cd /path/to /your/submodule
git remote set-url origin https://yourLogin#github.com/yourLogin/yourRepo
An ssh url would use automatically your key (in $HOME/.ssh/id_rsa.pub) which, if published to your account (and if your account is the owner or collaborator of the GitHub repo)