How see which github repository is connected to heroku app? - heroku

How can you see the code for an app, or link to its github repository if all you have is the app's name (i.e. url)?
The reason for asking is I have a few apps and I'm not sure which repositories they link to (some are very similar - if I can inspect the codebases, I can be sure which one's which)

Within the folder where the app is stored, there is a hidden folder called .git. Note the unusual leading dot; it's really there. Given that, and assuming that you have the command line Git client installed on your machine, do the following.
Open the Windows Explorer.
On Options dialog, ensure that the option to show hidden files is enabled.
Navigate to the folder that contains the app in question.
Open a command prompt in that window. The easiest way to do that is to click in the address box, and overtype the folder path with the word "cmd."
In the command prompt window that opens, enter git remote show origin.
The foregoing produces a report that looks like the following.
F:\Source_Code\Visual_Studio\Projects\_Laboratory\JSON_Jam 2019/05/25 14:38:27.98>git remote show origin
* remote origin
Fetch URL: https://github.com/txwizard/JSON_Jam.git
Push URL: https://github.com/txwizard/JSON_Jam.git
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (up to date)
F:\Source_Code\Visual_Studio\Projects\_Laboratory\JSON_Jam 2019/05/25 14:38:32.21>
The Fetch URL and Push URL, which are usually the same, contain the information that you need, which will look something like https://github.com/txwizard/JSON_Jam.git.
In the above URL, txwizard is my GitHub login ID, and JSON_Jam is the repository name.
If Windows doesn't recognize the command, you may need to install Git for Windows. When you run the installation program, tell it that you want the command line tools, and that you want it integrated with the native command processor, cmd.exe.

In command prompt window navigate to directory where your project is located and enter git remote -v

Related

Issues getting Git working with VSCode and files on web host

Until now I have always used FileZilla for transferring my local files to my host for changing a site Im working on. I want to change that and learn how to git gud! So basically the ideal situation would be to be able to work in VSCode on a directory which is mirrored from my web host and from there be able to make changes locally and then commit and change files on my web host when I want to - this has to be possible right?
I have been able to use Git Bash to connect to my host and files using ssh. I have created both an init --bare and init since Im not sure which one to use, but I do have the .git folder created there. I can also using the Bash and the command git status see all the files waiting for to be committed (?).
As I understand I have to initialize the repository, then commit them to "track" these files and have them visible in VSCode to work with, is this right?
But when I try to git commit following error message is displayed.
Waiting for your editor to close the file... code --wait: code: command not found.
This points to that the relative pathing to vscode and/or git is not working, but it is. When I start-up the bash I can use for example code --help and git config --global -e to launch a window of VSCode. So my git config --global core.editor "code --wait" is probably working as it should.
Although AFTER I have connected to my web host using ssh, neither of these command work anymore. Why is this?
And also, am Im on the right way right now in thinking on how to make this "connection" between VSCode, git and my web host (one.com)?
Im thinking that I have to create a local repository in the folder where I today have a duplicate of my web host-files and a remote repository at the actual web host and then make some kind of connection between them two and VSCode. Im not quite sure how yet.
Thanks in advance
I think you might be a little confused with what Git is and how you should be using it for what you want to do. Let's clear some stuff up.
Simply put, Git is a version control system for tracking changes to files over time. You create or edit your files, git add them to a "staging area" and then git commit them with a commit message. If you edit the files after committing them, then git can detect changes to the files and you can add and commit them again, or discard them depending on what you want. However the most important part to understand is that these changes are local at this point. If you want to share them with anyone (or have another system pull them down), then you will need to establish a remote repository.
This is what Github/GitLab are for. Log in/create an account on either site (gitLab provides free private repos) and create a repository named appropriately. Then once you have created a remote repo, follow the instructions to add it as a "remote" to your local repo, then git push your changes up to that remote one. Now, on your server, you will git clone the remote repo and that will pull down your changes. From then on, if you push new changes to the remote repo, you can pull the changes down to the server by doing git pull. This is a very basic and barebones approach to deploying code on the server and there are more sophisticated ways of doing it but I will keep it simple in this answer.
Git is completely separate from VSCode (although VSCode has some git integration and plugins). I would not recommend changing the core.editor to VSCode. What that setting controls is the editor that is used to author commit messages. Loading up VSCode takes too long for that...I recommend that you stick with the default Vim or use nano. Or, in most cases, specify a message when committing: git commit -m "added foobar".
So, the git repo that is on your server (the one that you init'd with --bare) is junk and should be instead created by git cloneing from a remote repo. Hopefully this makes sense!

Git Push is working via Terminal but not via Xcode

I've created a remote git repository on my local computer inside Google Drive folder
git init --bare project.git
and added the remote path as follows
git remote add origin '~/Google Drive/git/project.git'
When I commit via Xcode, it rightly shows the push option check box with correct branch (master in this case). I marked it checked and then press 'Commit and Push' and apparently it does so but actually not pushing to remote repository. When I push from 'Source Control -> Push', it shows successful message but my remote repository doesn't get updated.
When I run the push command from terminal then it does update the remote repository successfully.
git push origin master
How to fix so that Xcode (7.1.1) can push successfully?
Edited: A side note, this has troubled me a lot by the time I realized this. As initially, I think it was working via Xcode (maybe some prior version to 7) as well.
Edited: #VonC here is how I know how git push is working. The modified date gets changed for some objects in finder.
Edited: As per instruction by #VonC, now the push is working from Xcode when project.git is moved at different location out of 'Google Drive' folder. But, I want it to work with 'Google Drive' folder.
Edited: I further moved the project.git to a folder with name including space and again xcode is not pushing but terminal is still pushing.
Xcode 7.1 doesn't push to remote repo path with a space but Terminal does provided that the path is enclosed in quotes. Hope Apple would fix it for new releases.
I've got my issue fixed by renaming the 'Goolge Drive' to 'GoogleDrive' and adjusted the remote path accordingly. Google Drive App prompted for missing folder and I pointed it to the renamed one.
my remote repository doesn't get updated.
Try simply to clone that repo repo elsewhere to see if you get back the content you just pushed:
git clone ~/Google Drive/git/project.git /somewhere/else
Don't forget that a bare repo has no working tree, so after a push, you don't see any new file.
Note: if a remote repo path with a space is problematic to XCode, a possible workaround would be to push to a path without path:
either one which is a symlink to Google Drive
or a path which is rsync'ed after to Google Drive

Clone git repo hosted on a Windows shared folder from Mac OS X

I host a git remote repo on a Windows shared folder. I clone it using:
git clone //git-host-pc/SharedFolder/MyProject/
This command works from a Windows PC, but on a Mac, I get this error:
fatal: repository '//git-host-pc/SharedFolder/MyProject' does not exist
Trying git clone smb://git-host-pc/SharedFolder/MyProject gives me this error - fatal: Unable to find remote helper for 'smb'.
Note: I've found this question has been asked before mine - Use a git repos on a windows share from osx, however the OP there hasn't provided his exact commands, or the error messages, and that's why his question is unanswered.
Edit: I forgot to mention, but the shared folder is visible from the Mac, I can see it in Finder.
I kind of like to think that remote file system access is an OS thing, and that cloning repos is an application-level thing, so this would be my approach:
You should just be able to mount that SMB share with your OS'es functions to a local directory and clone from there, instead of hoping git has a transport for SMB.
How to mount:
Connect to the server on your Mac. Now, on your Mac, from Finder's Go menu, choose "Connect to Server." Enter the IP address you just obtained from your PC, preceded by smb://, as shown:
UPDATE: To use your PC's name instead of IP address, replace the number with the name. So if your PC's name is "MyWindowsBox", you'd use smb://mywindowsbox (not case-sensitive).
If it finds your server, you'll get prompted to enter your network credentials - by default, your Windows username and password:
Where to find the mounted folder:
Once I mounted the //git-host-pc/SharedFolder in that way, I found it in /Volumes/SharedFolder.
I've written this answer for those curious to know what git means by Unable to find remote helper for 'smb'
Git requires a helper program whenever it sees a URI such as ftp:// or smb://
When git encounters a URL of the form <transport>://<address>, where
<transport> is a protocol that it cannot handle natively, it
automatically invokes git remote-<transport> with the full URL as the
second argument
Source: https://git-scm.com/docs/git-remote-helpers
Basically you do not have git remote-smb installed. You can use git help -a to see what helpers you have installed.
Until somebody writes a git remote-smb helper, it's probably best to just mount the drive you want as mentioned in another answer.

Github Mac Permission Issue

I'm using the latest Github for Mac as a new Git user. When I try to sync a repo (that I first cloned, then created a new branch, commited changes, and then merged with master), I got the error:
Authentication Failed.
You may not have permission to access repo111. Check Preferences to make sure you’re still logged in.
I searched for similar questions, but the answer seemed to be add SSH keys to github, so I followed: https://help.github.com/articles/generating-ssh-keys.
When I do ssh -T git#github.com, I get:
Hi User111! You've successfully authenticated, but GitHub does not provide shell access.
I'm logged in as the correct user, and have rights to the repo, so I'm not sure why I'm not authenticated?
It could be that you entered a password incorrectly and it's stored in your keychain.
For my situation, I was using GitHub for Mac to work with a BitBucket repository. Long story short, I mistyped my BitBucket password and GitHub for Mac could not authenticate (because the password stored in my keychain was wrong).
Thanks to the helpful folks at GitHub, they quickly responded when I asked for help:
Open Keychain Access.app (in /Applications/Utilities) and search for "GitHub for Mac." There should be an entry like "GitHub for Mac — bitbucket.com". Delete that entry
Steps to fix if using GitHub for Mac to manage a BitBucket repo
If you see this:
… then you might have a BitBucket keychain/password problem.
Open Keychain Access.app (in /Applications/Utilities) and search for bitbucket:
Right-click on the entry and get info:
Click on "Access Control" to confirm that it's truly the GitHub for Mac BitBucket password/login keychain item:
Rather than deleting the keychain entry/item, I just edited my password:
You should now be able to use GitHub for Mac without authentication failures. :)
Had the same problem, but it was not a password problem, since other repositories worked just fine.
Finally compared .git/config with a working repository and found this:
This failed:
[remote "origin"]
url = github#github.com/path/to/repository
This worked:
[remote "origin"]
url = https://github.com/path/to/repository
Still have no idea how or why this changed.
I had to try some other stuff after the solutions above didn't work out for me.
Dont know why I got this issue, or why was fixed after:
deleting the existing keys:
.ssh/github-rsa
.ssh/github-rsa.pub
restarting GitHub Desktop, which automatically regens the keys
add new keys to repo host (bitbucket etc)
I had the same problem, then I followed this steps:
Login to BitBucket and go to the repository you want to use
Click the “Clone” button, and change the drop down option to HTTPS.
Copy the command that appears (something like: git clone https://username#bitbucket.org/team-name/repository-name.git)
Open terminal in your mac and navigate to wherever you want the theme files to be stored.
Paste the clone command in the terminal, press enter and then enter your password when requested.
In Github for Mac go to the repositories screen and click the + sign in the status bar.
Select Add Local Repository – and then select the repository of the folder you want to add.
Done
If you have created remote repository on GitHub and merged with local repository or project .
you can add that local repository to GitHub desktop app
than go to Repository > repository settings > Remote >
under remote You'll find primary remote repository (origin)
there's a ssh remote url delete that And
Go to your GitHub account.
Open Your Remote repository
click on Clone or Download
Copy the https URL
paste that in the GitHub desktop app
click on fetch in the Desktop GitHub App
It'll work Great :)
If your password is correct and you still see have this problem, chances are your .git/config file has some miss configuration.
In my case, it had a pushurl value under [remote "origin"] which was not needed (I was working on a cloned project).
Comment that line by adding a # before it and you are good to go :)
Also, if you get an error saying:
This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push
just delete that by doing
rm .git/hooks/pre-push
now you are all set. This happened to me also using github desktop app for mac, with a remote bitbucket repo.
hint: if you commit changes and refresh bitbucket to see the changes, those might not show, but navigate to the root of the project and then back to the file and you'll see the changes. Probably some cache issue but it can drive you mad if you don't know this hint.

Xcode 4.4 - no remotes found

Post-installation of 10.8 and Xcode 4.4 when I try to push to a remote using the Xcode integration Xcode is telling me 'no remotes found'. I am still able to push successfully via command line so my actual repositories are fine. I've installed the command line tools and have tried restarting Xcode several times. Additionally, if I go to Organizer and try to select the repository all I get is a spinning activity indicator. If I select 'remotes' for a given repository it's blank. Note that Xcode does recognize git is available though as it does show which files are modified and allows commits. Reported system git version in /usr/bin/ is:
git version 1.7.9.6 (Apple Git-31.1)
Is anyone else experiencing this, or do you have any suggestions for a remedy (or at least a place to look at a log to see what is going wrong)?
UPDATE 10/18/13
This issue has been resolved in Xcode 5.
When you add the remote repository in Xcode or in command line (doesn't matter from where you add it) make sure that you use the full path for your repository.
E.g.:
From commandline it's enough to specify
git remote add <name> gituser#gitserver:example.git
when your example.git is located in gituser's home directory. However Xcode can't deal with this annotation and says "No remotes found" when you try pushing your commits to this remote repository.
In order to satisfy Xcode you should type the whole path like:
git remote add <name> gituser#gitserver:/home/gituser/example.git
I have found this solution for Xcode with Git:
Organizer > remotes > origin
1) remove old remote
2) add new remote:
remote name: origin
location: same as before, but replace all ":/" or "//" by "/" only
I had the same problem with Xcode 4.6.3.
Here are the steps I performed to resolve the problem:
1. In Xcode I went to File -> Source Control -> Repositories (which opens the Organizer)
2. I then selected the Remotes object from the tree for the Repository I was having the problem with.
3. My remote was named origin, however when expanding it, I noticed it did not have a Branch associated with it.
4. I then selected the remote origin and pressed the Remove Remote option, which removed the remote origin from the view.
5. I then went to a terminal and re-added the remote with:-
`git remote add origin http://username#localhost:7990/scm/iac/main-repository.git`
6. I then needed to add the branch(es) to this remote, which did not worked correctly initially, so I then forced it using the -f command. The command I used was:-
`git push origin master -f`
Note: It may have been possible to skip steps 4 and 5 and just go straight to step 6. I had removed the remote, so did not have the chance to test this.
Note 2: You will need to restart Xcode (or possibly just the Organizer) to see that the remote and branch are now available.
you need first add a remote repository: git remote add yourname https://github.com/user/repo.git
and than push... and xcode find the remote repo and can push too.
I've had the same issue with SSH defined hosts.
My ~/.ssh/config looks like this:
Host myGitServer
HostName {real address goes here}
{Some more config for the host here}
My repository remote URL was in the form of ssh://myGitServer/git/project.git
The problem was that XCode did not read the SSH config to resolve "myGitServer" so the repository was always "offline" for it.
I ended up adding "myGitServer" to /etc/hosts.
I guess that among other things, the "no remotes found" issue is caused when XCode can't directly resolve the name of the GIT remote server.
I had a similar problem where remotes were failing to load, specifically for kiln as the remote host. Looking in the git config for the repository info, the URL had been changed to prepend my email address to it.
So I simply exited Xcode, and then from the command line did:
git remote set-url kiln https://...kiln repo name.git
And that seemed to fix it when I restarted Xcode - both pull & push worked again.
I have no idea why Xcode corrupted the URL. This was with Xcode 4.6.3
1- search and apply the guideline. which is mentioned about "show all hidden files in mac finder". and delete .git directory (this folder wont appear without solving article-1)
2-XCode>Prefences>Accounts>Delete github account and close xcode. than open and reconfigure same github account by adding all over.
3-click the section small icon namely "source control navigation" (which is near the project navigator). as you right click a popup will appear. and choose create blabla on github". actually this steps solved same issue.
Xcode 10.2.1
Double Check:
1) Git Acc under preferences.
2) cmd + 2, right click under remote to create a remote.

Resources