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
Related
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.
I need to export an Eclipse project to GitHub. I am using Eclipse-Mars with the eGit plugin. I have spent hours reading documentation, tutorials, and posts and see that there are basically two ways
Create an Eclipse project and a local Git repository. Commit to local repository. Create a repository on GitHub. Push the Eclipse project to the repository on GitHub. When I try this, I get the error "rejected non-fast-forward". I have no idea why. I did create a .gitignore on GitHub when I created the repository - is that causing a problem?
Create a repository on GitHub. In Eclipse, clone this repository and then add files. Commit to local repository, then push. This works, but I end up with a weird configuration on GitHub:
reponame/myprojname/src
when I would prefer the more normal
reponame/src
Which method is the correct way to proceed? Why do I get the push error in the first method, and why the strange folder layout in the second?
You first need to pull the github code into you local machine.
=> git remote add origin
=> git pull origin master
will automatically fetch and merge the github repo with your local copy. You may need to resolve some conflicts that could be generated due to 3-way merge.
After all this, you can use -
=> git push -u origin master
For the second Point,
If you want src/ directory directly under reponame/ on github, then you should execute git clone after creating the project in eclipse and git clone should be executed inside the myprojectname/ directory.
When you created the .gitignore file on GitHub, you created a commit in the repository that isn't in your local copy. You'll need to add the GitHub repo as a remote, pull the change, and then push your local changes:
git remote add origin <path to your repository>
git pull origin master
git push -u origin master
I'm trying to setup jekyll by following this setup. For that I created a public repository and under the same name on my computer cloned the project.
However once I try and push the code, it gives me following error -
fatal: 'aniruddhabarapatre.github.com' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I tried doing Git setup in case something got overridden, but am unable to finish the process and it hangs on
git credential-osxkeychain
Make sure you are pushing to the right github repo.
Its url should be
https://github.com/aniruddhabarapatre/aniruddhabarapatre.github.com
If git remote -v doesn't show this, do a:
git remote set-url origin https://github.com/aniruddhabarapatre/aniruddhabarapatre.github.com
And try to push again.
For the credential issue, see this answer, or this one, or (for checking how git is installed) this answer.
When you create a git repository add git ignore files, then it no more push unwanted files
Git global ignore
errors like this will occur when you try to push to a GitHub which you did not connected with the local repository you have in your machine. We can resolve this in a such way!
One: Delete your local repository and clone your GitHub project to your local machine($git clone ..url..) and now you can push any change directly to your GitHub account. If you do not want the original file from your local machine because you have some code on it you can move that to some where other than the directory you going to clone it. Then paste the content of your change inside newly cloned folder. Some time the issue/error may still persist so lets move to the second option.
Two: Here you mostly play with GitHub and follow this instruction since I did this many times.
From your terminal
To initialize the local directory as a Git repository
$git init
Add the files to your new local repo
$git add .
commit the file
$git commit -m "any comment you want to say"
Add the URL for the remote(GitHub) repository
$git remote add origin ..url..
Set the new remote
$git remote -v
Push the change
$git push -u origin master
Now if you go to your GitHub repo you will see your change.
While pushing the terminal might say pull first bla bla ... in that case you can force your push by saying
"$git push -f origin master"!!
Hopefully this will be helpful.
I have repository in GitHub. I edited files in my PC, committed them and now I want to push these files to GitHub. How can I do it?
If the files are already cloned from a github repository git push will do it.
cd /path/to/repo
git push
If this local repo does not belong to any github repo, create a repository in github. This will give you a git repo url like git://github.com/username/project.git. Now you need to add this url as remote to your existing local repository
cd /path/to/repo
git remote add origin git://github.com/username/project.git
Then you can commit your changes and push it
git push
Go to github and create a repository under your account (if you haven't already). If you've done that, follow the instructions for pushing code from an already existing repository.
I’m supposed to work on my client's project on GitHub, where the changes would be on his repository. I tried to follow the fork example, but could only get the changes to go to my account repository?
In the example on GitHub, to fork a repo, they create a remote called upstream to point to the original project. I can get the changes from it by
get fetch upstream
git merge upstream/master
I was able to upload the changes into my repo by
git push –u origin
which copied my changes to my account.
I tried
git push –u upstream
To push my changes on the original account. I got the following error
You can’t push to git://github.com.octocat/SpoonKnife.git
use git#github.comoctocat/Spoon0-Knife.git
Basically, in order to collaborate with your client, you've got two main options:
Send your client a pull request (more info on this in this GitHub help item). This allows your client to review, discuss and/or request some changes to your proposal before merging it.
Request from your client to be added as a committer to their project. This would allow you to directly push your commits to their repository, without the need for a fork/cloned repository on your side.
As a side note, Spoon-Knife.git is one of GitHub's read-only repository (used for demonstration purpose) and you will not be able to commit to that (unless your client is GitHub). Thus, your client's upstream git remote should point to a different repository
Here are the steps (to be followed after you forked and cloned the repository to your local disk):
Remove the upstream reference: git remote rm upstream
Add in your client's info - git remote add upstream git#xxxxxx
Push your changes - git push -u upstream master . git push -u will set the HEAD of the remote repository.
Same if you want to pull - git pull upstream master
If you prefer the name origin replace upstream with origin, but still follow step 1 to remove the reference to Spoon-Knife.git. Then in step 2 - git remote add origin git#xxxx.
git://github.com.octocat/SpoonKnife.git is a read-only URL. As GitHub suggests, the corresponding write-able URL is git#github.comoctocat/Spoon0-Knife.git.
If you want to be able to push on the upstream repository, you will have to ask (to the upstream team, i.e., your customer) to be added as a committer.