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

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

Related

Git push creates my project folder inside another folder, how to avoid it?

I have been creating some repositories of my projects since the terminal and everything was good, but recently I tried to push a project to GitHub and but another folders are created.
For example, the path of my project folder is /Desktop/Programming_course/React_Native/robotreact.
So, since the terminal I go to the path of my Project robotreact and I run:
git add .
git commit -m "first commit"
Then, in GitHub, I create my repository and after that I run:
git remote add origin https://github.com/Josesosa0777/robotreact.git
when I push it running: git push -u origin main
In my GitHub are created other folders:
How can I avoid those extra folders?
It seems like if another project is added, I am not sure if the problem is about a SSH key, I dont know how to solve it, any idea?
That means you have initialized your Git repository in / instead of /Desktop/Programming_course/React_Native/robotreact: check for /.git
If that is the case, and you don't have many commits, you can simply:
delete /.git
initialize the repository in the right folder,
add the remote origin
add files, commit and push
That is:
cd /Desktop/Programming_course/React_Native/robotreact
git init .
git remote add origin https://github.com/Josesosa0777/robotreact.git
# check your user.name/user.email
git config user.name
git config user.email
git add .
git commit -m "First import"
git push -u origin main
If your local branch is master:
git push -u origin master:main

How to push code to someone else repository from visual studio

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.

How to commit code to GitHub on Android through termux app

Please I would appreciate if anyone can drop a direct link to the termux commands used to create repos,commit code and delete them on GitHub through termux terminal,all I have seen through numerous Google searches are only how to install them,I also don't know how to navigate to a certain file or directory.
First of all you have to install git in termux pkg install git . then go to the directory where your code have with cd <name of your directory>
If you want to create a git repository use git init.
then add the files to git
git add <file name> OR add all files in the directory git add .
First commit after installing git you have to specify who you are
git config --global user.name "<Your Name>"
git config --global user.email "<your_email#whatever.com>"
then commit the code with
git commit -m "<commit message>"
commit message is what changes you done in this commit
you have to create a reposityory in github github.com/new
and add github reposityory url to git git remote add origin https://github.com/<github username>/<github repository name>.git
then push the repository to github. git push -u origin master
-u means seting upstream as default. after that just git push
have some reference of tutorials about git
learnxinyminutes, githowto

How to push on my development branch on Github

I get an issue when I try to push on my development branch on Github. Actually, I forked the microscopejs repository to update some files...
Command :
git clone https://github.com/tonymx227/microscopejs.git
git add remote upstream https://github.com/tonymx227/microscopejs.git
git fetch upstream
// I updated some files using Sublime Text 2 here
git add . -A
git commit -m 'test'
git push origin development
Issue :
error: src refspec development does not match any.
error: failed to push some refs to 'https://github.com/tonymx227/microscopejs.git'
You haven't create a local development branch.
You only have the remote tracking branch origin/development after your clone.
Do first a:
git checkout -b development origin/development
Then:
git add . -A
git commit -m 'test'
git push -u origin development
Note: you don't need the git remote add upstream step.

Error when commiting to Github from command line

Every time I try and commit changes to GitHub from the command line (after following the tutorial below from GitHub) I get the erorr "fatal: I don't handle protocol 'https:https'"
I'm following this short tutorial from GitHub.
Create a new repository on the command line
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/tuzion/baby-companion.git
git push -u origin master
Thanks!
-- I'm on a Mac, btw.
Did you input the SSH keys into the Github Account Setting?
Check your account setting/SSH keys..