Sourcetree git push remote: Repository not found - atlassian-sourcetree

I cloned a repo from the CLI using git clone https://github.com/**.git
Then I added this repo to Sourcetree, committed some changes and tried to push, but is presented with:
remote: Repository not found.
fatal: repository 'https://github.com/**.git/' not found
However, git push worked properly in the CLI.
I'm using Github with 2FA, but am sure I entered the token instead of my Github's password.
Have checked https://help.github.com/articles/error-repository-not-found/ but since it works fine with the CLI, I'm not sure what I'm missing.

I edited the token's permission to allow private repos.
Its working now.

Related

gitlab push is asking for github credentials?

I'm trying to push some files to a Gitlab project which I've already created in the GitLab GUI. So I'm trying to add some files to that project which already exists.
When I try:
git remote add origin https://git.doit.wisc.edu/my_user_name/my-website.git
I get this error:
error: remote origin already exists.
So I figured I could move on to the next step in the documentation - git branch.
Then I use:
git branch -M main
I was prompted with:
I entered my keychain password and all seemed fine but when I try to do:
git push -uf origin main
The terminal reads:
Username for 'https://github.com':
I put in my username and then get this error:
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.
It seems like git is confusing gitlab and github. I'm trying to push to gitlab, not github. I'm so confused here. Is there something I'm missing in the first step?
No, Git's not confused here. When you said, git remote add origin… and Git reported an error, that means that the remote origin already exists for that repository. In this case, that remote points somewhere on GitHub, which you can see with git remote -v.
If you want to replace the existing URL for the origin remote, use git remote set-url origin https://git.doit.wisc.edu/my_user_name/my-website.git. If you want to create a new, differently named remote, then do git remote add gitlab https://git.doit.wisc.edu/my_user_name/my-website.git and push with git push gitlab main.
Note also that GitHub no longer allows you to use your account password to authenticate with Git. Instead, when prompted for a password, go to https://github.com/settings/tokens and create a token with the repo scope, and use that instead. However, in this case, since you're intending to push to GitLab, that shouldn't matter here.

Link the Heroku cloned project with another existing Github repository of User

I have cloned sample project from Heroku:
git clone https://github.com/heroku/node-js-getting-started.git
cd node-js-getting-started
When I run git remote -v I get:
Now I want to link my existing GitHub repository (i.e.: https://github.com/user/my-repo) with the cloned project.
My main goal is, if I push anything to GitHub, I want the changes to be happened in both places, the Heroku repository as well as my repository (i.e: https://github.com/user/my-repo).
I have cloned sample project from Heroku
You have cloned a sample project from GitHub. You won't have permission to push to that repository, but if you did, you'd be pushing to GitHub, not to Heroku.
Now I want to link my existing GitHub repository (i.e.: https://github.com/user/my-repo) with the cloned project.
Assuming that repository is empty, simply change the URL your remote points to:
git remote set-url origin https://github.com/user/my-repo.git
Now your origin remote points to your own repository.
My main goal is, if I push anything to GitHub, I want the changes to be happened in both places, the Heroku repository as well as my repository (i.e: https://github.com/user/my-repo).
Normally, you'd be able to enable GitHub integration and configure pushes to your GitHub main branch to trigger a build on Heroku, but that feature is currently disabled while Heroku investigates a security breach.
Until that gets resolved I suggest you add a second remote:
Install the Heroku CLI
Log into Heroku with heroku login
Add a remote with heroku git:remote -a YOUR_APP
Then verify that you can push to both remotes individually:
git push origin main
git push heroku main
You can continue to deploy that way, and I suggest you do.
But if you really want to, you can add your Heroku push URL to your origin remote so git push origin main actually pushes to GitHub and Heroku. Heroku outputs useful build information when you push to it and I'm not sure how well the two outputs will be kept separate if you do this.

Error While commiting to Github

remote: Repository not found.
fatal: repository 'https://github.com/vivekghanchi/portfolio.git/' not found
You need first to create your repository in GitHub (it's done directly in your Web browser). Then you can do a git push to upload your local commits to the new repository.
Also, after creating your GitHub repository, make sure the url you are pushing to matches that of GitHub, I notice an extra / at the end of your url, which should not be there.
To see the url you are pushing to, issue:
git remote -v
the repository is deleted but I was committing to a new repository after than also it is showing this
Committing is a local operation.
Make sure your remote url matches the one of your new repo.
Update it with:
cd /path/to/my/local/repo
git remote set-url https://github.com/vivekghanchi/aNewRepo
Then try to push again:
git push
Pushing is not "committing to GitHub", but rather "publishing your local commits to your upstream GitHub repository".
You need first to create your repository in GitHub (it's done directly in your Web browser). Then you can do a git push to upload your local commits to the new repository.
Committing is a local operation.
or your can add already existing repo
git remote add origin remote repository URL

Remote permission denied in github while trying to push to origin

I have started to contribute to a public repository on GitHub, but after I have created a pull request it says remote: Permission when I am trying to push another code to my origin.
remote: Permission to una/CSSgram.git denied to Pradhvan. fatal:
unable to access 'https://github.com/una/CSSgram.git/': The requested
URL returned error: 403
Anyone else having the same problem. The issue would be you had cloned the repo from Github of the owner(here Una's repo) and you are pushing that change directly to the repo. This is the not right way as you don't have permission to push changes to that repo.
The right step would be:
Fork the original repo so you get a copy of it. Url of your forked repo would be something like https://github.com/<your Github username>/<repo_name>
Clone the repo that you just forked.
Create a branch (git checkout -b "MyPatch1") and now make the changes to the code.
Push the changes to your fork (git push origin MyPatch1)
Open Github and go to the owner's repo and you would see a button appear Click the Compare & pull request button.
Congratulation! You have successfully created a pull request.
PS: The funny thing is this question just showed up after 4 years. xp

Can't clone private repos using command line clone command (despite owning them)

Using command line, I can clone my public repos but cannot clone my private repos.
I have many private repos - and have been branching, committing, etc with no problems. But, today things seem to have broken. When I try to clone a repo, I get
Cloning into 'XYZRepo'...
remote: Repository not found.
fatal: repository 'https://github.com/user/XYZRepo.git/' not found
(uname and repo names have been changed).
I checked
* the clone address is correct (I copied it directly from the repo)
* git config --global user.name (and user.email) are correct
Also, I do not have any .git directory in the folders I'm trying to clone to.
Any ideas on what could be going on here?
The source of the problem seems to have been the credential management.
If I cloned with the full username:password# format (i.e. git clone https://:#github.com/user/XYZRepo.git" then the repo is found and cloned without generating any error.
To get to the source of the problem I read up on credential management... and still don't understand how I see what credentials are stored and being used (it's "magic"). So, I just reinstalled git and github clients - and the "magic" seems to be back.
NOTE: "--unset-all" might be a possible solution as well git credential.helper=cache never forgets the password?