Setting up new github repository - unknown switch `u' - github

I am trying to setup a new repository on my existing GitHub account.
I followed the steps circled here:
When I run the command git push -u origin master, I get the following error:
error: unknown switch `u'
Any ideas as to the issue? Doing a Google search for this error didn't seem to cough-up anything useful.

It seems your git client is too old. Try to update it to most recent version:
http://git-scm.com/

Ignore the error: unknown switch `u'
Try what they say here, http://help.github.com/create-a-repo/
$ git push origin master

I believe that this:
$ git push -u origin master
...is equivalent to:
$ git push origin master
$ git config --add branch.master.remote origin
$ git config --add branch.master.merge refs/heads/master
So if you're running an older version of Git that doesn't support -u for git push, run that group of 3 commands instead.

Related

What's wrong in git init ...?

When I use git init it only shows (master) and not (master -> origin), and then that when I use the command: git push -u origin master it returns an error:
error: src refspec master does not match any.
error: failed to push some refs to 'github.com:BghAek/something.git'
Most probably this happened:
Forget to add the remote repo link
You have created a new repository using the init command, but it looks like you forgot to add the link to the remote repository. So do the following:
Remove the `.git` file from you local system.
Create a clean repository using the following:
git init
git add .
git commit -m "COMMIT MESSAGE"
git branch -M main
git remote add origin REMOTE_REPOSITORY_LINK
git push -u origin main
replace REMOTE_REPOSITORY_LINK with that of the remote repository link. Remember your are on main branch, so as to keep it consistent with the remote branch( read more here).

git clone is throwing repository not found error

While trying to clone my private repository, I'm getting the following error
fatal: repository 'https://github.com/kefitech/qp-guard.git/' not found
I have done some googling but unable to solve the issue.
Steps completed
1. config --global user.name and password is set using terminal (windows cmd)
2. git remote -v
git remote -v is returning an error:
fatal: not a git repository (or any of the parent directories): .git
So, tried set the remote URL to my repository using the command:
git remote set-url origin https://<my-user>#github.com/<my-org>/qp-guard.git
Bur this also returning the same error returned by git remote -v command
Please note that:
1. I'm a collaborator
2. I can clone any public repos
3. I have not used git client (terminal, cmd) for a long time but it was working before.
Looking forward to any pointers to solve this issue.

How to resolve "fatal: unable to access " error

I'm a beginner to GitHub.I need to send a pull request to the master branch.
when i typed the code
git push origin master
It gives me the error
fatal: unable to access
'https://github.com/www-prolificme-com/mahawiki/': The requested URL
returned error: 403
Updated
You mentioned you are trying to pull from git but the command is git push. Anyways, most probably you are getting this error because your repo url is not set locally.
If this is the first time you are sending git request from your system, you might want to setup your username by git config --global user.name "John Doe"
If you have already used git on your system, try checking the git configuration on your system using git config --list command to check whether your repo URL is setup or not.
If the url is not setup run git remote set-url origin https://github.com/www-prolificme-com/mahawiki/
Run git remote -v to verify if your url is setup
git add .
git commit -m "your message"
git push origin master
Remove/Update the saved credentials:
Click Start
Search for 'Credential Manager'
Select 'Windows Credentials Manager' > 'Windows Credentials'
Search for the credentials that you want to remove/update
Click on the credential entry > Click 'Edit' or 'Remove'
your repo is not setting locally
so, you seemed crash message
first
git config --list
to showing your git repo set list
and
git remote set-url origin <your git repo address>
to access git repo and git add . to add your files to git container
git commit -m "your git commit message"
this is your git commit message version or anything possible
git push origin master
finally your files pushing on git repo
it's done!
try it
I got this same problem then I try to this below command.
step 1:
git config --global user.email "user email"
step 2:
git config --global user.name "user name"
After running those commands, you can use this command to push your code:
git push origin master
Even if you set all credentials and other setups in the local machine, you might face this problem.
Currently, GitHub uses 'personal access token' so when or after creating personal access token you must check the Select scopes.
You select all you need and then push again.
It will be pushed successfully.
If nothing working please check if you have checked the below checkboxes while creating token

Fatal: master cannot be resolved to branch

Here's a screenshot of what I'm dealing with:
I'm a new GitBash user and am getting this error when trying to push to GitHub.
I was following this tutorial. So far I've not run into any problems, except I get this error when I try to push:
Fatal: master cannot be resolved to branch
Things I've done correctly:
I am signed in
I have specified my name and email using git config -global... *blah blah*
Everything is committed and should be ready to push
I'm on the master branch that I wish to push.
I've added my remote repository using command git remote add origin https://github.com/Tawnwen/MyApp.git.
I tried to push using the command git push -u origin master
Can anyone please help?

Github- repository is on remote but not found when pushing

I'm trying to push something to github and I'm getting this error;
Robbies-MacBook-Pro:assn-6-huffman-mac user$ git push -u origin master
fatal: repository 'https://github.com/BitMechanic/Stanford-CS106b/Huffman.git/' not found
Then when I check I get this;
Robbies-MacBook-Pro:assn-6-huffman-mac user$ git remote add origin https://github.com/BitMechanic/Stanford-CS106b/Huffman
fatal: remote origin already exists.
Robbies-MacBook-Pro:assn-6-huffman-mac user$ git remote -v
origin https://github.com/BitMechanic/Stanford-CS106b/Huffman.git
(fetch)
origin https://github.com/BitMechanic/Stanford-CS106b/Huffman.git
(push)
Anyone know what I'm doing wrong?
The proper url to use (for cloning and then pushing through origin) is
https://github.com/BitMechanic/Stanford-CS106b.git
not:
https://github.com/BitMechanic/Stanford-CS106b/Huffman.git
Stanford-CS106b is a repo, listed in the BitMechanic's repo page of d. Stanford-CS106b/Huffman is not.
To fix this, see git remote commands:
git remote rm origin
git remote add origin https://github.com/BitMechanic/Stanford-CS106b.git
or, simpler:
git remote set-url origin https://github.com/BitMechanic/Stanford-CS106b.git
Can you paste the
$cat .git/config
output here for reference.
Sometimes it is better to remove the remotes that are misbehaving from there and re-add it using the git remote add command again.