I have a GitHub repository where I put my jupyter notebooks in it. While I open my notebooks in GitHub, I usually see a pencil button where I can Edit my notebook:
However for some other notebooks in the same repository it disappears:
Why this happens and how to fix it?
It is simply because of the size of the file. Github does not allow editing large files (not sure what is the exact size limit) It sometimes even restricts viewing such files, and they can be viewed only in the raw mode.
To edit these files, edit them in your local clone and push them to the desired branch using git cli, Github Desktop, SourceTree etc.
Edit: Answer is outdated now. Please see the workaround mentioned in comments.
As per Wayne Bloss' comment, it's actually possible to exchange the blob to edit in the URL and edit files that have the edit button hidden.
https://github.com/orga/repo/blob/branch/folder/filename.extension becomes https://github.com/orga/repo/edit/branch/folder/filename.extension
In my case, it was a lifesaver because I couldn't checkout the file on Windows due to an illegal character in the name of the file.
Related
Sometimes I want to provide a link to some source code in the comment to an issue.
If I open repository in browser and find the fileI need, the link refers to master branch by default. It means that over time the code referred by the link will change, because the master will move together with commits history.
In GitHub and GitLab when you want to get a permanent link on a file you just opened, it is enough to press y on the keyboard and the link will switch from referring the master branch to particular commit hash it points to.
I.e. https://github.com/octocat/Hello-World/blob/master/README -> https://github.com/octocat/Hello-World/blob/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d/README
At work I use BitBucket server (v7.10.1, if it matters) and unfortunately the y does not work, and I also do not see any button on UI to get permanent link. How can I achieve the same result (get permanent link) on BitBucket server?
I know a couple of tricks I am not satisfied with:
using Bitbucket Linky plugin for Intellij, but I want a more light-weight way
pressing History button on a file, and choosing the most recent one (but it does not give you the master hash, it gives the hash of the last change of the file. And also this button won't work if the file has a single version and never changed after the 1st commit)
Got to the version you want, and then click 'Raw file' (top right hand side of screen)
The path in the address bar should now be a permanent link. It will be the raw version of the file unfortunately, but it is a permanent link.
I am trying to use codesandbox by importing the github repository. I am not able to edit the contents of the package.json file. It says cannot edit in ready only editor. How to solve this error?
step1: Ctrl+save
step2: Refresh the webpage from the web browser.
That's it. You are good to go now.
You can't even edit any other files for github repository. You can fork that codesandbox and then edit.
I also met that kind of situation and it worked after fork.
In my case, I just went back to the Dashboard, and re-opened the sandbox. Then I was able to edit it like usual. However, I did notice that the GitHub linkage was gone then.
If you go to the Dashboard in CodeSandbox you can re-open your code from there. After opening your code, click on the Github icon. You can see the option to Export to Github, and you can see how many changes you have made.
But if you open your code from the link on Github you will be in a read-only editor mode.
If this is the first time to open the code in CodeSandbox (for example, you are viewing somebody else's code) then you have to fork it in order to edit it.
I want to link to a line of code in such a way that the link will continue to work even when the file is updated in future commits.
In Github I would do this by pressing 'y' to move to a version of the page that includes the blob SHA:
https://github.com/rails/rails/blob/b49e38b76b0998b0a8312d8c08c98728d3de2006/activerecord/lib/arel/attributes/attribute.rb#L30
(Alternatively GitHub has a 'copy permalink' option in the '...' menu that appears in the margin when you select a line - documented here.)
Is there an equivalent in Azure DevOps?
The link that I get when I select a line has the form:
https://.../_git/project?path=XXXX&version=GBmaster&line=426&lineStyle=plain&lineEnd=427&lineStartColumn=1&lineEndColumn=1
Lots of parameters defining the selection but nothing pinning the file version.
Edit:
The below illustrations can be summarized in a few keyboard shortcuts.
Open the repo Files view using the 'e' global shortcut
Use 't' to put focus on the path selection to quickly navigate to the file in question
point 2 and 3 are order agnostic in relation to one another
Use 'y' to change the Files view to be based on the latest commit instead of on the branch
Make selection
Copy link as shown in illustration below
Browse files on the commit
Make sure you're browsing the entire source for the commit. Selecting lines when viewing the commit itself (ie AzDOs fancy git show) is for adding comments to the commit, but it doesn't help produce a link to the line # that version, nor is there a way (at least not that I could find) to get a link to the comment made on the line. Getting a link to a comment on a line in a commit might have been helpful to provide additional direct context to what is linked and why, but that's also not what you asked for.
don't click on the commit itself
make sure you're browsing all files as of a commit (not a branch)
Make selection
You should be able to select a line in the file contents and get a link to that line(s) in that version.
note: the link produced here is even more lengthy than the one you provided in your question.
Joy
When you navigate to the copied link, you will be directed to the commit and file contents with the line highlighted.
Understand, this link is bound to the commit you used to create it not to the tip of the branch. I expect this was how links are surfaced to be more sure that the link wouldn't break or lose context as the commit at the tip of the branch changes over time.
Thank you #JoshGust. For anyone else who wants the abbreviated version:
Files -->
(your repo branch) -->
History -->
Click A Commit hash/number (Latest/Head usually) -->
Browse Files -->
Your file -->
Select text & get a link.
Sheesh... quite some hoops to jump through, but glad it's possible.
To create a web (repository) link to a specific line from within your IDE, there are extensions with options to link to files, selections, to a branch or to a specific commit.
I am using these ones:
Editor
Plugin
Visual Studio Code
Git Web Links for VS Code
Visual Studio 2022
Git Web Links
I want to move an image in my GitHub repository to a new folder. I know to move a text file you can click the edit icon in the top right but there is no edit icon for pictures. How can I move the picture on GitHub in the browser?
Update: The OP changed the title after my answer. The original question said GitHub Desktop not GitHub Browser - https://stackoverflow.com/posts/52977306/revisions
GitHub Desktop tracks all changes to all files as you edit them directly in the file system.
Just move the files directly using Windows Explorer and commit your changes to the repository using GitHub Desktop after moving the file.
Step-by-step instructions here:
Committing and reviewing changes to your project
You might also be interested in reading the other topics in the documentation, to get up to speed:
https://help.github.com/desktop/guides/contributing-to-projects/
Images are binary data. Adding, removing, and even updating those images can cause unnecessary usage of your repository's space. This is because images, videos, and other binary data are larger than the text files where our code is written. For personal projects, one could use this site (or another) to upload all of your images: https://imgbb.com/. Then URLs of each image will be provided for use anywhere in an app without the need to store those images in an actual repo.
Very new to Github and I downloaded the desktop application in hopes of understanding it better. What I'm trying to do is commit/push files by dragging them into my repository folder, but they don't show in application when moved? I tried editing a txt file and as soon as I save it, it appears. I don't want to have to edit every file I add to my repository as I edit it elsewhere. How do I make the non-edited, dragged-and-dropped files appear?
Also, is there an official GitHub support forum? I can't find anything on their website where you can ask questions/etc and I'm not sure StackOverflow is the best place for this question.
Thanks!
That's the way how git works. It doesn't make sense to add every time the unedited files.
When it notices you added/edited/removed files, git will know that.
I pasted a file (blocks.gif) in my repository and in GitHub Desktop it I see the following (click the 1 uncommitted change) and you should see the new files there. Then you can write a commit message and commit the changes.
Also, is there an official GitHub support forum?
When you need help using GitHub, you can always contact the support team (or write an email to support#github.com). They are awesome people. :)
https://github.com/contact