Not able to add remote repository - github

I want to push changes from my local repository to my github repo. I start with the commands giving from github quickstep:
git init
git add .
git commit -m "first commit"
and then
$ git add origin https://github.com/Svein-Tore/forrigling.git
fatal: pathspec 'origin' did not match any files
Any suggestions to what can be wrong?

You've to use git remote add origin https://github.com/Svein-Tore/forrigling.git
When you use git add origin, it tries to add the file 'origin'

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

How do I find the private git repository URL?

Where in my repository under the code it's not showing any URL
It is usually git#github.com:<username>/<reponame>.git
In command line you have to go to your project directory and type:
git init
This is going to initialise Git in you project directory
To add your project to Git you have to add a commit
git add .
followed by your commit message
git commit -m "<message>"
message can be anything you want to write to identify that commit... You can write First commit for example
After that you will want to set your origin url
git remote add origin git#github.com:<organisation_name>/<reponame>.git
The organisation_name is most probably the account that created the repo
With your origin set you can push it to Git:
git push origin master

How to push changes to old repo to GITHUB after downloading it

I lost my PC data after hard-drive corruption. After that from my github repo i downloaded my code and made some changes and did npm install, but when i tried to push my changes to repo, it is saying there are no currently active repo to push.
How to push my new changes to my old repo?
You should have cloned the repo on your local machine, that way you would have the git initialized. But, for now, you can follow the below steps.
git init
git remote add origin <github repo url>
The first line would initialize the git repo and the second would point it to the online repo you already have.
You could have downloaded the repo with:
git clone <repo url>
but to answer your question:
git init
git add .
git commit -m "init"
git remote add origin <repo url>
you can then verify the remote url with:
git remote -v
after that check If your .gitignore file is there, if not create one and add node_modules/
after that just push it with:
git push -f origin master
just check whether you have set the remote origin correctly.
$ git remote show origin
$ git remote -v
use the above commands to check your remote URL. if it is not set correctly, set the URL again.
$ git remote set-url < your repo URL here >
hope this will work

Github - How to update my own repository?

I have a repository in my Github, and I cloned it on my desktop. Then I did some work in the folder. How do I commit those changes to my repository?
below code is right, but don't forget to add remote address to key "origin".
git remote add origin <YOUR_REPOSITORY_PATH>
git add .
git commit -m 'some change'
git push -u origin master
-u – sets repo branch as defaults, so then you can push, just git push
May
git add .
git commit -m "my changes"
git push origin master

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.