Here is my problem
I am using heroku to develop an app and I am using github along with it for a project.
Now when I try and use github(clone) without heroku to work on a different project it says...
michael#michael-HP-PavilionNotebook-PC:~$
michael#michael-HP-PavilionNotebook-PC:~$
michael#michael-HP-PavilionNotebook-PC:~$ git init
Initialized empty Git repository in /home/michael/.git/
michael#michael-HP-PavilionNotebook-PC:~$ ls
Desktop Downloads gifiniti Music Pictures Templates Ubuntu One
Documents examples.desktop gifinitiApr24 oldgifiniti Public tmp Videos
michael#michael-HP-PavilionNotebook-PC:~$ git clone git#github.com:toadiferus/SecretTunnel
Cloning into SecretTunnel...
! Invalid path.
! Syntax is: git#heroku.com:<app>.git where <app> is your app's name.
fatal: The remote end hung up unexpectedly
michael#michael-HP-Pavilion-dv6700-Notebook-PC:~$
How would I resolve this error? Can't find any support online for this specific problem.
HOw can I change the syntax of the commands? I want to just clone a project from github not heroku.
THANKS!
Michael
Your ~/.ssh/config may have been hijacked by if you used the heroku accounts plugin. Same thing happened to me. I removed the contents of my ssh config and all is well!
Firstly, you don't need to init before you clone - init is used to turn a project folder into a git repository unless you really intended to turn your entire user directory into a git repo? I would suggest you delete the .git folder that would have been created from your doing this.
To be sure you're using the correct path go to your projects on github and use the icon that looks like a clipboard to copy the correct url to your clipboard, paste onto your command line and see what happens then.
I also don't understand why when you do a
git clone git#github.com:toadiferus/SecretTunnel
Cloning into SecretTunnel...
you get what looks like a Heroku push error??? Git clone from a github URL should simply clone the project from github to your local machine.
! Invalid path.
! Syntax is: git#heroku.com:<app>.git where <app> is your app's name.
Are you editing the output you are pasting?
The git url should have .git on the end, ie. git#github.com:toadiferus/SecretTunnel.git.
Related
I'm trying to clone a repo to my computer. I do the standard
git clone [link to bitbucket repo]
and then call
git branch -a
to see my remote branches, which shows
remotes/origin/develop
which is the branch I want to checkout into. However, when I type
git checkout develop
I get an error that says
error: invalid path '.\api-log\api.log'
and it fails to create the local develop branch. Is this happening because there is something wrong with the file? If so, how can I fix/remove the file so that the clone will go through? All the work is in the develop branch and nothing in the master.
I'm using Windows.
Apologies if this has been answered before but I couldn't find anything.
I don't know exactly why this happen but I suggest you to remove the offending file from the repository history by the wonderful BFG tool.
At this url https://rtyley.github.io/bfg-repo-cleaner/ you can get the software and the documentation.
I am struggling with properly configuring a git workflow for a laravel project. I created the laravel project locally. At the base directory I used the git init command. Then connected the repository to the bitbucket repository set up by the company I am working for like so:
git remote add origin https://address/xyz.git
I then made some new changes to a few of the files. Did a commit and then pushed to origin like this:
git push -u origin master
Now I logged into our development box (which is not my local dev box). Built the laravel default laravel application and then tried to pull down the project specific files by connected the dev box's laravel directory to the same repository, but I keep getting the following error:
error: The following untracked working tree files would be overwritten by checkout:
.gitignore
composer.json
package.json
resources/js/app.js
resources/js/bootstrap.js
webpack.mix.js
Please move or remove them before you can switch branches.
I know I probably missed some simple step or did not set up the development box correctly, but I can't find this scenario in the documentation and I can't seem to discover what I did wrong. Can anyone help?
It sounds like the repository on the main development box has some local changes that are not checked into git. Run the command
git status
On the remote development box. This will tell you any local changes.
If you want to remove any local unchecked in changes you can type
git reset --hard (resets any tracked files)
git clean -Xdf (resets all untracked files)
If you want to preserve any local changes, you can type
git stash
git stash --pop (recovers the changes - this may induce some conflicts)
Thanks for listing those tools Ben W, but it turns out that I the wording of my question was deceptive. When I went to the second machine (the development box), I should have built the laravel instance by using the git clone command.
git clone https://address/xyz.git
What I did instead, was build another full instance of laravel and try to link it to the same repository I created from the first box (my local notebook).
I upvoted your answer anyhow Brad W. because those are all great tools to know. Thanks.
As is shown in the image,I'm not sure if the failure is caused by some missing property while setting up webstorm .
The issue is not resolved after a lot of efforts.As a learner,I don't know what to do now.
Meanwhile,something seems wrong as shown in git bash.I've no idea whether the two are directly related.
If you have ever faced these difficulties,could you please give me some idea? Even if it's only a web address.
What I want to do is only pushing my code. Anyone who pushed successfully in any other way will be welcomed to share your method.
If I'm being honest I'm not sure that I completely understand your question, but I will supply some information that will hopefully lead you down the right track.
First in the bash shell, cd (change directory) into your project directory like this:
$ cd /c/foo/bar/yourprojectfolder
In your project top most directory, do you have a .git folder? You may have to show hidden folders in windows to see this directory. If not, you need to initialize a repository with the init command.
$ git init
Initialized empty Git repository in C:/foo/bar/yourprojectfolder/.git/
After running this command, you should see a .git folder inside of the directory you changed to (used cd to get to) earlier.
Next, in order to push, you first need a remote repository to push to. Based on your first picture, I believe that you have successfully created a repository on GitHub. If not however, just log into GitHub and click the 'New Repository' button:
Once a repo has been created, you need to add it as a remote to your local git (in git bash). To do this you need a url (either SSH or HTTPS) to your repo. You can find this url inside of your repository in online GitHub. If you are not certain you have set up SSH, it's best to use the HTTPS url. It should look something like this, but the url itself will be different and specific to your repository:
Copy that url to your clipboard, and then back in git bash run:
$ git remote add origin <PASTE YOUR URL HERE>
You need to make an initial commit of your code to have something to push:
$ git add .
$ git commit -m "Initial commit"
Finally, with the origin repo set up and a commit made, you should be able to push to your origin repo
$ git push -u origin master
You should now be able to view your code on GitHub.
Using Windows 7, we have a bare GIT repository set up on a network drive so that multiple users can pull/push from it. I am able to create a new working repo on my local and multiple other networked drives. However, when I try to clone a new working repository on the same network drive (different folder) , it fails.
Using TortoiseGIT, after I right-click and choose "GIT Clone", put in all of the necessary paths to my bare repo (the new working repo is already filled in) and hit ok, I get the following error:
Cloning into 'R:\path\to\new\repo'... done.
error: refs/remotes/origin/master does not point to a valid object!
error: Trying to write ref refs/heads/master with nonexistent object 5d2164db2c61efc7a5598f6ff75ed3fbbb12456e
fatal: Cannot update the ref 'HEAD'.
fatal: The remote end hung up unexpectedly git did not exit cleanly (exit code 128)
and it fails to create the repo. It does however build the new folder & ".git" subfolder structure.
It's not a r/w permissions issue because I can r/w any other files, but just cannot seem to create this newly cloned repo. My co-worker cannot either. Even if I got to another folder on the network drive, I still cannot clone the repo successfully. Surprisingly, if I just copy/paste a repo I created in another location, then manually do a "pull", it works and updates successfully.
Any ideas on what to try next? Obviously I've Googled "exit code 128" and "cannot update the ref 'HEAD'" but cannot find a solution to my issue. It's probably something really simple that we are overlooking, but we're just getting started with GIT and this is really causing us headaches...
UPDATE: I just noticed that when I do a manual pull from GIT to my "copy", it is doing a Fast-Forward. Maybe this provides some additional clues?
From R:/path/to/repo
* branch master -> FETCH_HEAD
Updating 5d2164d..d75bdb7
Fast-forward
Files.py | 3 +++
1 file changed, 3 insertions(+)
Success
Git might be trying to do some smart stuff with hardlinks that fails on the network drive. Try using git clone --no-hardlinks /r/path/to/my/repo or git clone file:///r/path/to/my/repo
Please do this via command line in msysgit
git clone /r/path/to/my/repo /r/some/other/path
Further, I would recommend using git from the command line as it is a tool that was designed to be used from the command line. You will be able to find more help, faster, with any issues that come up for you.
Good times!
Please, hint me this moment - I use the Windows account with cyrillic account-name. When I try to add my local git repository to github.com, I get the mistake "Could not create directory c/Users/\204\206" ... and I suspect due to my account is cyrillic.
So - how to change this behavior? I want to use Git without changing or renaming account?
Git doesn't create any directories when you add a remote repository. That is, if you type a command like this:
git remote add origin git#github.com:you/yourproject.git
The only thing that happens is that git adds a couple of lines to the .git/config file.