How to push code to someone else repository from visual studio - github

I have made a react native project on visual studio code. I want to push this project to someone else's git repo.
I did the following:
git remote add origin https://github.com/aasthaverma1212/Android_Project.git
git branch -M main
git push -u origin main
It gave me error that remote: Permission to XXXXXXX/Android_Project.git denied to pXXXXXXXX4. fatal: unable to access 'https://github.com/XXXXXXX/Android_Project.git/': The requested URL returned error: 403
I even tried to do git config --global user.email 'XXXXXXXXXX#gmail.com'
And then again I did git push -u origin main
It still gives me the same error.

Related

GitHub - failed to create remote repository

I have a repository- 'repo1' in our company's GitHub cloud.
git remote -v, shows -
origin git#github.****:***/repo1.git (fetch)
origin git#github.****:***/repo1.git (push)
Now I am trying to add a new remote repo - 'repo2' with the command line:
projectName=repo2
mkdir $projectName
cd $projectName
git init -b $projectName
touch README.md
git add README.md
git commit -m 'Initial commit'
git remote add origin ****:***/repo2.git
git push -u origin $projectName
and I get an error in the last command:
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
It is worth emphasizing that the repo was created with local success.
also, git remote -v, shows
origin git#github.****:***/repo2.git (fetch)
origin git#github.****:***/repo2.git (push)
but failed to push to remote.
also is worth emphasizing, that I could add a new repo in our GitHub site. The only problem occurs when adding from the terminal.
I found on GitHub forums, that the new repo must be created on GitHub site before doing the git push

error: failed to push some refs /github/visual Studio

I am raising my project to github, first I opened github and put New Repository and then I put "Repository Name" and then I choose "Private" , then create Repository", and after that a set of instructions appeared to me, then I opened the project in Visual studio and then within the Visual studio I opened the terminal and wrote these instructions that appered to me:
git init
git commit -m "first"
git config --global user.email "Nour77#gmail.com"
git config --global user.name "nour-George"
git remote add origin https://github.com/nour-George/FFFF.git
git push -u origin master
But I got this error when I put the last instruction:
error: failed to push some refs to 'https://github.com/safaa-Haddad/Base.git'
How do I solve the problem and is there an error in applying the previous steps ?
you need to add files before commiting files
git add .
git commit -m "Commit message"
git push -u origin master

Unable to push local repository to GitHub

Unable to push local repository to GitHub
Steps followed:
mkdir github-local
cd github-local
git init
touch README.md
git add .
git commit -m "test commit"
git remote add origin git#github.com:sounak-patra/github-local.git
git remote -v
git push --set-upstream origin master
Output:
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Create the remote repository first in order to push into that repository. Before trying to add remote repository (step #7) you must create the remote repo.
The error is self explanatory:
ERROR: Repository not found. fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

Unable to commit my project to github

I am using Gitbash to commit my project but I am getting the below
error and the repository which I am getting in fatal error is not the
remote repository to which I am doing a commit.
I want to change this repo
$ git push -u origin master
Fatal: HttpRequestException encountered.
Username for 'https://github.com': 4bhishekKasam
remote: Repository not found.
fatal: repository 'https://github.com/4bhishekKasam/Authentication-using-Passportjs.gi/' not found
now I created new repo still i am unable to commit
First, your error is when you want to push your commits to the remote GitHub repo, not when you commit.
You are able to commit: it is a local operation which does not care about the remote repo.
But try:
cd /path/to/local/repo
git remote set-url origin https://github.com/4bhishekKasam/Passportjs.git
(or git remote add origin ..., if you didn't set origin before)
Then your git push -u origin master will work.

fatal: https://github.com/user/repo.git/info/refs not found: did you run git update-server-info on the server?

I am running the following script to set up a git repository on GitHub:
Global setup:
git config --global user.name "Your Name"
git config --global user.email email_id#email.com
Next steps:
mkdir MultiView
cd MultiView
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin https://github.com/nalgene/MultiView.git
git push -u origin master
The last line git push -u origin master or git push origin master for that matter returns an error:
fatal: https://github.com/naglene/MultiView.git/info/refs not found: did you run git update-server-info on the server?
I researched the issue and it seems the most likely reason is a typo (case sensitive) but I made sure that is not an issue. I used git remote -v to check the origin is correct. What else can be the issue?
You have to carefully look after your spelling. According to Github's guide, your username is nalgene, hence the URL is https://github.com/nalgene/MultiView.git. The error message hints that you added the remote as https://github.com/naglene/MultiView.git which is not the same username, as you swapped the l and g.
Also, the default branch is called master, not maaster or mater.
With Github, you must first make sure that you've made the repository on github itself before trying to push to it from your side. See this answer:
https://stackoverflow.com/a/12407847/735614
Did you make the repo there? Or are you only making it on your side and trying to create it on the server by pushing?
This is almost too obvious to mention, but this can also happen if you forget to create a new repository on Github before running git push.