i have a problem with my git accout every time i excute "git push" enter image description here
I have discovered that im working with ssh url enter image description here
and i try to get back with https url using git config --global url.https://github.com/.insteadOf git://github.com/ and git config --global url."https://".insteadOf git:// but it won't change enter image description here i try many solution such as manuelly configuration of config file but nothing works
CodePudding user response:
To use git
with ssh
, a different url syntax is needed, with git@<url>
as url.
According to your screenshot, the url should most likely look like this
[email protected]:ahlemtbini/blog_web.git
You can change it with the following command
git remote set-url origin [email protected]:ahlemtbini/blog_web.git
If you are using github
, i recommend you to always use the url's listed under the code
-button at the github
-page of that repository. More information here
For more information about protocols used by git, read the page about git server protocols.
CodePudding user response:
So there's a few things going on here I think:
The error from your first screen shot looks like it may be caused by having cloned the repository using the plain
git://
protocol which doesn't do any type of authentication/authorization. Meaning you cangit pull
but you won't be able togit push
.If you want to update your git config to automatically use
https
when pushing, you can add something like this to your gitconfig:
[url "https://github.com/"]
pushInsteadOf = git://github.com/
- assuming you have your Personal Access Token cached
- Alternatively if you want to use SSH instead of
git://
orhttps://
protocol (and have your public key uploaded to your GH account) you can add
[url "[email protected]:"]
pushInsteadOf = git://github.com/
pushInsteadOf = https://github.com/